/* AI page: prompt → frame generator + lab cards */

.gen { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(18px, 2.4vw, 36px); align-items: stretch; }
.gen-stage {
  --gen-bg: #121214; --gen-ink: #f1efea;
  position: relative; min-height: clamp(420px, 66vh, 720px); border-radius: var(--radius); overflow: hidden;
  background: var(--gen-bg); border: 1px solid var(--line); outline-offset: 4px;
}
.gen-gl { position: absolute; inset: 0; width: 100%; height: 100%; }
.gen-fallback { display: none; }
.gen-stage.static .gen-gl { display: none; }
.gen-stage.static .gen-fallback { display: block; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 88%; max-height: 84%; height: auto; width: auto; border-radius: 4px; }
.gen-hud { position: absolute; left: 16px; right: 16px; top: 14px; display: flex; justify-content: space-between; gap: 12px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); pointer-events: none; }
.gen-step { color: var(--text); font-variant-numeric: tabular-nums; }
.gen-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--line); }
.gen-prog i { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }
.gen-done {
  position: absolute; left: 16px; bottom: 18px; max-width: calc(100% - 32px); display: grid; gap: 6px; padding: 10px 14px 12px; border-radius: 10px;
  background: color-mix(in oklab, var(--bg) 82%, transparent); border: 1px solid var(--line);
  opacity: 0; transform: translateY(8px); transition: opacity 0.4s, transform 0.5s var(--ease-out); pointer-events: none;
}
.gen-done.on { opacity: 1; transform: none; }
.gen-done b { font-size: 15px; font-weight: 650; line-height: 1.25; }

.gen-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.gen-console { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); padding: 14px 16px 12px; display: grid; gap: 10px; }
.gen-console-top { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.gen-console-top span:last-child { text-transform: none; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.gen-text { margin: 0; min-height: 7.2em; font-family: var(--f-mono); font-size: 13.5px; line-height: 1.6; color: var(--text); }
.gen-text.typing::after, .gen-text:empty::after { content: ''; display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: -0.2em; background: var(--accent); animation: caret 0.9s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.gen-console-bot { display: flex; justify-content: flex-end; }
.gen-console-bot .btn svg { width: 16px; height: 16px; }
.gen-console-bot .btn:hover svg { transform: rotate(-30deg); }
.gen-side .pg-hint { margin: 6px 0 -4px; }
.gen-list { display: grid; gap: 6px; }
.gen-item {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font-weight: 600; font-size: 14.5px;
  transition: border-color 0.2s, background-color 0.25s, transform 0.3s var(--ease-out);
}
.gen-item b { font-weight: 500; font-size: 11px; color: var(--muted); }
.gen-item .gen-ar { font-size: 11px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.gen-item:hover { border-color: var(--line-strong); transform: translateX(3px); }
.gen-item[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
.gen-item[aria-pressed='true'] b, .gen-item[aria-pressed='true'] .gen-ar { color: var(--bg); border-color: color-mix(in oklab, var(--bg) 40%, transparent); }
.gen-own { align-self: flex-start; margin-top: 4px; }

/* lab cards: one wide, one narrow */
.ai-lab { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(14px, 2vw, 28px); }
.ai-lab-card { display: grid; grid-template-rows: auto 1fr; text-decoration: none; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--surface); transition: transform 0.45s var(--ease-out), border-color 0.3s; }
.ai-lab-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.ai-lab-prev { position: relative; aspect-ratio: 16 / 9; background: #050506; overflow: hidden; }
.ai-lab-ar .ai-lab-prev { aspect-ratio: 16 / 11; }
.ai-lab-prev img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; }
.ai-lab-prev .pf-gl { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.6s; }
.lab-pf.live .pf-gl { opacity: 1; }
.ai-lab-tag { position: absolute; left: 12px; top: 12px; font-size: 10.5px; letter-spacing: 0.1em; color: #fff; background: rgba(0, 0, 0, 0.5); border-radius: 999px; padding: 4px 9px; }
.ai-lab-body { padding: clamp(18px, 2vw, 26px); display: grid; gap: 8px; align-content: start; }
.ai-lab-body h3 { margin: 0; font-family: var(--f-display); font-weight: var(--display-w); font-variation-settings: var(--display-vs); font-size: clamp(22px, 2vw, 30px); letter-spacing: var(--display-ls); }
.ai-lab-body p { margin: 0 0 8px; color: var(--muted); max-width: 46ch; }
.ai-lab-body .link-arrow { justify-self: start; }

@media (max-width: 900px) {
  .gen { grid-template-columns: minmax(0, 1fr); }
  .gen-stage { min-height: 0; aspect-ratio: 4 / 5; max-height: 72svh; }
  .gen-text { min-height: 6.4em; font-size: 13px; }
  .gen-side .pg-hint { display: none; }
  /* prompts become a swipeable row of chips under the console */
  .gen-list { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .gen-list::-webkit-scrollbar { display: none; }
  .gen-item { flex: none; scroll-snap-align: start; grid-template-columns: auto auto auto; }
  .gen-console { order: 2; }
  .gen-list { order: 1; }
  .gen-own { order: 3; }
  .ai-lab { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .gen-text.typing::after, .gen-text:empty::after { animation: none; }
  .gen-item, .ai-lab-card, .gen-done { transition: none; }
}
