/* Motion Studio. Studio Stage look: deep navy, one spotlight, white reel previews as the only bright thing.
   Spacing 4 8 12 16 24 32 48 64 96. Type 12 14 16 20 24 32 48. Inter 400/700, Instrument Serif for display titles only. */
:root {
  color-scheme: dark;
  --bg: #07080C; --surface: #11141D; --raise: #181C28; --ink: #F2F4F8; --mute: #A3AABA; --line: #262B3A;
  --glow: #8EA6FF; --blue: #1D5BFF; --blue-ink: #FFFFFF; --focus: #8EA6FF;
  --yes: #4ADE80; --check: #F5B942; --no: #FF8A80;
  --rail: 72px; --r: 16px;
  --serif: "Instrument Serif", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font: 400 16px/1.5 Inter, system-ui, sans-serif; color: var(--ink); background: radial-gradient(80% 60% at 50% 0, #182036 0, var(--bg) 60%) fixed, var(--bg); min-height: 100vh; }
a { color: inherit; }
b, h3, th { font-weight: 700; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 50; padding: 8px 16px; background: var(--surface); }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code, pre { font-family: ui-monospace, Menlo, monospace; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }

/* rail */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0; background: rgba(7,8,12,.8); backdrop-filter: blur(12px); border-right: 1px solid var(--line); z-index: 10; }
.rail a { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 8px 0; border-radius: 12px; text-decoration: none; font-size: 12px; color: var(--mute); text-align: center; }
.rail a[aria-current] { color: var(--ink); background: var(--raise); }
.rail a:hover { color: var(--ink); }
.rail svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rail .mark { width: 40px; height: 40px; padding: 0; margin-bottom: 16px; justify-content: center; background: var(--blue); color: var(--blue-ink); font-weight: 700; font-size: 20px; border-radius: 12px; }

/* shell */
.shell { margin-left: var(--rail); padding: 24px 32px 48px; min-height: 100vh; }
.top { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.top h1 { font: 400 32px/1.1 var(--serif); letter-spacing: .01em; }
.top .sub { color: var(--mute); }

/* stage: one move, big, under a sweeping light */
.stage { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) minmax(200px, 260px); gap: 48px; align-items: center; padding: 32px 48px; border: 1px solid var(--line); border-radius: 24px; background: radial-gradient(60% 80% at 30% 20%, #20263A 0, #0B0C12 65%, #050608 100%); outline: none; scroll-margin-top: 16px; }
.beam { position: absolute; z-index: -1; left: 22%; top: -320px; width: 900px; height: 900px; margin-left: -450px; background: conic-gradient(from 180deg at 50% 0, transparent 160deg, rgba(142,166,255,.14) 174deg, rgba(142,166,255,.24) 180deg, rgba(142,166,255,.14) 186deg, transparent 200deg); filter: blur(12px); animation: sweep 9s ease-in-out infinite alternate; pointer-events: none; }
@keyframes sweep { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
.still .beam { animation: none; }
.s-preview .frame { border-radius: 24px; box-shadow: 0 0 0 8px #151A2A, 0 40px 80px rgba(0,0,0,.6); }
.s-info { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.kick { font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--glow); }
.s-info h2 { font: 400 48px/1 var(--serif); letter-spacing: .005em; }
.s-use { color: var(--mute); max-width: 56ch; }
.say { display: flex; flex-direction: column; gap: 4px; padding: 12px 16px; border-left: 4px solid var(--glow); background: rgba(142,166,255,.08); border-radius: 0 12px 12px 0; max-width: 56ch; }
.say span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.s-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.s-actions button, .tabs button, .code summary { min-height: 44px; padding: 8px 16px; color: var(--ink); background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.s-actions button:hover, .tabs button:hover, .code summary:hover { border-color: var(--glow); }
.s-actions .primary { background: var(--blue); color: var(--blue-ink); border-color: var(--blue); font-weight: 700; }
.s-step { display: flex; gap: 8px; }
#s-replay { display: inline-flex; align-items: center; gap: 8px; }
#s-replay svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.s-actions .icon { width: 44px; padding: 0; display: grid; place-items: center; }
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.code summary { display: inline-flex; align-items: center; list-style: none; }
.code summary::-webkit-details-marker { display: none; }
.code summary::after { content: "+"; margin-left: 8px; color: var(--mute); }
.code[open] summary::after { content: "−"; }
.tabs { display: flex; gap: 4px; margin-top: 12px; }
.seg { display: flex; gap: 4px; }
.tabs [aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tabs .copy { margin-left: auto; }
pre { margin-top: 8px; max-height: 280px; overflow: auto; padding: 16px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: #05060A; border: 1px solid var(--line); border-radius: 12px; }
.meta { display: grid; grid-template-columns: 1fr; gap: 4px; font-size: 14px; color: var(--mute); padding-left: 24px; border-left: 1px solid var(--line); }
.meta dd + dt { margin-top: 12px; }
.meta dt { color: #7C8498; }
.meta dd { overflow-wrap: anywhere; }

/* browse: every move */
.browse { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
input[type=search] { flex: 0 1 280px; min-height: 44px; padding: 8px 12px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
input[type=search]::placeholder { color: #7C8498; }
.cats { display: flex; gap: 8px; flex-wrap: wrap; }
#cats { min-height: 44px; }
#grid:empty { min-height: 100vh; }
.cats button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; }
.cats button span { color: var(--mute); font-size: 14px; }
.cats button:hover { border-color: var(--glow); }
.cats button[aria-pressed=true] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cats button[aria-pressed=true] span { color: inherit; opacity: .7; }
.motion-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; color: var(--mute); }
.motion-toggle input { width: 20px; height: 20px; accent-color: var(--blue); }
.count { color: var(--mute); white-space: nowrap; margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.tile .open { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 8px 8px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); cursor: pointer; transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .2s; }
.tile .open:hover { transform: translateY(-4px); border-color: #3A4260; }
.tile .open[aria-current] { border-color: var(--glow); box-shadow: 0 0 0 1px var(--glow), 0 0 32px rgba(142,166,255,.25); }
.frame { position: relative; width: 100%; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 12px; background: #fff; --k: .2; }
.frame iframe { position: absolute; left: 0; top: 0; width: 1080px; height: 1920px; border: 0; transform: scale(var(--k)); transform-origin: 0 0; pointer-events: none; }
.cap { display: flex; flex-direction: column; gap: 0; padding: 0 4px; min-width: 0; }
.cap .id { font-size: 14px; }
.cap b { min-height: 3em; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.id { font-weight: 700; color: var(--glow); font-variant-numeric: tabular-nums; white-space: nowrap; }
.use { padding: 0 4px; font-size: 14px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 48px 24px; text-align: center; color: var(--mute); border: 1px dashed var(--line); border-radius: var(--r); }
.empty button, .pm-empty button { min-height: 44px; padding: 8px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.hint { font-size: 14px; color: #7C8498; }

/* pages */
.page { max-width: 880px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; display: flex; flex-direction: column; gap: 16px; }
.page h2 { font: 400 48px/1.05 var(--serif); }
.page h3 { font-size: 20px; margin-top: 16px; }
.page p, .page li { max-width: 68ch; }
.steps, .rules { padding-left: 24px; display: flex; flex-direction: column; gap: 8px; }
.ranges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ranges div { padding: 12px 16px; border-radius: 12px; background: var(--raise); display: flex; flex-direction: column; }
.ranges span { color: var(--mute); }
.lede { color: var(--mute); }
.note { font-size: 14px; color: var(--mute); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
thead th { position: sticky; top: 0; background: var(--surface); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
tbody th a { text-decoration: none; }
tbody th a:hover { text-decoration: underline; }
.v { display: inline-block; padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: 12px; text-transform: uppercase; border: 1px solid currentColor; }
.v-yes { color: var(--yes); } .v-check { color: var(--check); } .v-no { color: var(--no); }
.why { margin-top: 8px; font-size: 14px; color: var(--mute); min-width: 200px; }
#lic td:first-child { min-width: 220px; }

/* Prompt Motion: video wall, each clip in its own shape, like on prompt-motion.com */
.page.pm { max-width: 1200px; }
.pm-bar { display: flex; flex-direction: column; gap: 8px; }
.pm-bar input[type=search] { flex: none; max-width: 480px; }
.pm-bar .motion-toggle { align-self: flex-start; }
.pm-bar .count { margin-left: 0; }
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; z-index: 5; }
.x[data-tip]:hover::after, .x[data-tip]:focus-visible::after { bottom: auto; top: calc(100% + 8px); left: auto; right: 0; transform: none; }
.x { position: absolute; }
.lbl { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.pm-list { list-style: none; padding: 16px 0 0; columns: 3 280px; column-gap: 24px; }
.page .pm-list li { max-width: none; }
.pm-card { display: flex; flex-direction: column; gap: 12px; padding: 0 0 32px; break-inside: avoid; }
.pm-play { display: block; padding: 0; border: 0; border-radius: var(--r); background: #000; cursor: pointer; overflow: hidden; width: 100%; }
.pm-vid { display: block; aspect-ratio: 16 / 9; max-height: 640px; }
.pm-vid video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s cubic-bezier(.16,1,.3,1); }
.pm-play:hover video, .pm-play:focus-visible video { transform: scale(1.03); }
.pm-main { display: flex; flex-direction: column; min-width: 0; }
.pm-t { font-weight: 700; text-decoration: none; }
.pm-t:hover { text-decoration: underline; color: var(--glow); }
.pm-by, .pm-tags { font-size: 14px; color: var(--mute); }
.pm-skill { color: var(--ink); }
.pm-near { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pm-near span { font-size: 12px; color: var(--mute); margin-right: 4px; }
.pm-near a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 12px; background: var(--raise); color: var(--glow); font-weight: 700; font-size: 14px; text-decoration: none; }
.pm-empty { column-span: all; }
.pm-play { position: relative; }
.pm-play.failed::after { content: "Preview can't load. Open the title to watch it on prompt-motion.com."; position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-size: 14px; color: var(--mute); background: var(--raise); }
.pm-fail { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px 24px 0; color: var(--check); }
.pm-fail button { min-height: 44px; padding: 8px 16px; background: var(--raise); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--ink); }

/* Prompt Motion full video */
dialog { margin: auto; width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: var(--ink); box-shadow: 0 32px 64px rgba(0,0,0,.6); overflow: auto; }
dialog::backdrop { background: rgba(2,3,6,.75); }
dialog[open] { animation: rise .32s cubic-bezier(.16,1,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.x { position: absolute; top: 16px; right: 16px; z-index: 2; width: 44px; height: 44px; font-size: 24px; line-height: 1; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.pmd video { display: block; width: 100%; max-height: 70vh; background: #000; }
.pmd-info { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px; }
.pmd-info h2 { font: 400 32px/1.1 var(--serif); padding-right: 48px; }
.pmd .btn { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 12px; background: var(--blue); color: var(--blue-ink); font-weight: 700; text-decoration: none; }
html.locked { overflow: hidden; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); padding: 12px 24px; border-radius: 12px; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* tablet */
@media (max-width: 1279px) {
  .stage { grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); align-items: start; }
  .meta { grid-column: 2; grid-template-columns: auto 1fr; gap: 4px 16px; padding-left: 0; border-left: 0; }
  .meta dd + dt { margin-top: 0; }
}
@media (max-width: 1024px) {
  .stage { gap: 32px; padding: 32px; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); }
  .s-info h2 { font-size: 40px; }
}
/* phone: rail becomes bottom tabs, stage stacks */
@media (max-width: 767px) {
  .rail { inset: auto 0 0 0; width: auto; height: 64px; flex-direction: row; justify-content: space-around; padding: 0 8px; border-right: 0; border-top: 1px solid var(--line); }
  .rail .mark { display: none; }
  .rail a { width: auto; flex: 1; }
  .shell { margin-left: 0; padding: 16px 16px 96px; }
  .top { margin-bottom: 16px; }
  .top .sub { font-size: 14px; }
  .stage { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 24px 16px; }
  .beam { left: 50%; }
  .s-preview { width: min(62vw, 240px, 22vh); margin: 0 auto; }
  .s-info { gap: 12px; }
  .np { display: none; }
  .s-info h2 { font-size: 40px; order: 1; }
  .kick { order: 0; }
  .s-actions { order: 2; flex-wrap: nowrap; }
  .s-actions button { padding: 8px 12px; }
  .s-actions .primary { flex: 1; }
  #s-replay { width: 44px; padding: 0; justify-content: center; }
  #s-replay span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .s-use { order: 3; } .say { order: 4; } .code { order: 5; }
  .meta { grid-column: 1; }
  .toast { bottom: 88px; max-width: calc(100vw - 32px); }
  .bar { gap: 8px; }
  input[type=search] { flex: 1 1 100%; }
  .cats { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px 4px; -webkit-mask-image: linear-gradient(90deg, #000 70%, transparent 98%); mask-image: linear-gradient(90deg, #000 70%, transparent 98%); }
  .cats button { flex: none; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .use, .hint { display: none; }
  .page { padding: 24px 16px; }
  .page h2 { font-size: 40px; }
  .pm-list { columns: 1; }
  html { scroll-padding-bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { transition: none !important; animation: none !important; } }
