:root {
  --bg: #0b0f1a;
  --card: #151b2b;
  --text: #e8ecf5;
  --muted: #9aa4b8;
  --primary: #7c5cff;
  --accent: #22d3ee;
  --line: #252d42;
  --primary-hover: #5b3de0;
  --btn: #6847f0;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .08);
  --font-head: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
}
img, video { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--text); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0 0 16px; }
h1 { font-size: 48px; }
h2 { font-size: 28px; margin-top: 48px; }
h3 { font-size: 18px; margin-top: 24px; }
p { margin: 0 0 16px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* header / footer */
.site-head { border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font: 700 18px/1 var(--font-head); }
.brand .gf-site-icon { width: 28px; height: 28px; border-radius: 8px; }
.nav { display: flex; gap: 24px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); }

.site-foot { border-top: 1px solid var(--line); margin-top: 64px; padding: 32px 0; color: var(--muted); font-size: 14px; }
.foot-row { display: grid; gap: 12px; }
.foot-brand strong { color: var(--text); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 16px; }
.foot-nav a { color: var(--muted); }
.foot-nav a:hover { color: var(--text); }
.foot-copy { margin: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 24px;
  background: var(--btn); color: #fff;
  border: 0; border-radius: var(--radius);
  font: 600 16px/1 var(--font-body); text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }

/* hero */
.hero { padding: 32px 0 24px; max-width: 70ch; }
.hero h1 { margin-bottom: 12px; }
.lede { color: var(--muted); font-size: 18px; }

/* studio: monitor + deck */
.studio { margin-bottom: 48px; }
.m2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.m2-monitor { background: #05070d; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; position: sticky; top: 16px; }
.m2-screen {
  position: relative; width: 100%; margin: 0 auto;
  background: #000; border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.cm { position: absolute; width: 20px; height: 20px; border: 2px solid var(--accent); opacity: .85; z-index: 2; pointer-events: none; }
.cm-tl { top: 10%; left: 10%; border-right: 0; border-bottom: 0; }
.cm-tr { top: 10%; right: 10%; border-left: 0; border-bottom: 0; }
.cm-bl { bottom: 10%; left: 10%; border-right: 0; border-top: 0; }
.cm-br { bottom: 10%; right: 10%; border-left: 0; border-top: 0; }
.hud { position: absolute; z-index: 2; font: 600 12px/1 var(--font-mono); color: var(--accent); letter-spacing: .04em; pointer-events: none; }
.hud-tl { top: 12px; left: 12px; }
.hud-tr { top: 12px; right: 12px; color: var(--text); }
.hud-bl { bottom: 12px; left: 12px; color: var(--muted); }
.hud-br { bottom: 12px; right: 12px; color: var(--muted); }
.m2-idle, .m2-busy { position: relative; z-index: 1; text-align: center; padding: 48px 24px; max-width: 36ch; }
.m2-idle-title { font: 700 22px/1.2 var(--font-head); margin-bottom: 8px; }
.m2-idle-sub, .m2-busy-sub { color: var(--muted); font-size: 14px; margin: 0; }
.m2-busy p:first-of-type { font-weight: 600; margin-bottom: 8px; }
.m2-rec { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #ef4444; margin-bottom: 12px; animation: m2blink 1.2s steps(2, start) infinite; }
@keyframes m2blink { to { visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .m2-rec { animation: none; } }
.m2-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: 3; }


.m2-deck { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 16px; }
.m2-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: var(--bg); border-radius: var(--radius); }
.m2-tabs button {
  min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font: 600 14px/1.2 var(--font-body); cursor: pointer; padding: 4px 8px;
}
.m2-tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.m2-panel { display: grid; gap: 12px; }

.m2-frames { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m2-drop {
  position: relative; display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 112px; padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted); font-size: 14px; cursor: pointer; overflow: hidden;
}
.m2-drop:hover { border-color: var(--accent); }
.m2-drop strong { color: var(--text); }
.m2-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.m2-drop img { width: 100%; height: 112px; object-fit: cover; border-radius: 8px; }
.m2-drop-wide { min-height: 64px; }
.m2-refthumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.m2-refthumbs:empty { display: none; }
.m2-refthumb { position: relative; width: 64px; height: 64px; }
.m2-refthumb img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.m2-refthumb.is-loading img { opacity: .4; }
.m2-refthumb button {
  position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: var(--bg); color: var(--text); cursor: pointer; font-size: 16px; line-height: 1;
}

.m2-urls { display: grid; gap: 12px; }
.m2-urls label, .m2-prompt { display: grid; gap: 8px; font-size: 14px; font-weight: 600; }
.m2-opt { color: var(--muted); font-weight: 400; }
.m2-hint { color: var(--muted); font-size: 14px; margin: 0; }
.m2-label { font-weight: 600; font-size: 14px; }
textarea {
  width: 100%; resize: vertical; padding: 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  font: 400 16px/1.6 var(--font-body);
}
textarea:focus { border-color: var(--accent); outline: none; }
.m2-prompt { position: relative; }
.m2-count { justify-self: end; color: var(--muted); font: 400 12px/1 var(--font-mono); }
.m2-examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.m2-examples button, .m2-dl button {
  background: none; border: 1px solid var(--line); color: var(--text); border-radius: 8px;
  padding: 4px 12px; min-height: 32px; font: 400 14px/1 var(--font-body); cursor: pointer;
}
.m2-examples button:hover, .m2-dl button:hover { border-color: var(--accent); }

.m2-opts { display: grid; gap: 12px; }
.m2-opt-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.m2-opt-group legend { font-size: 14px; font-weight: 600; margin-bottom: 8px; padding: 0; }
.m2-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.m2-chips button {
  min-height: 36px; min-width: 52px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  font: 600 14px/1 var(--font-mono); cursor: pointer;
}
.m2-chips button[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.m2-switch { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.m2-switch input { width: 18px; height: 18px; accent-color: var(--primary); }
.m2-action > div { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.m2-go { min-width: 200px; }
.m2-cost { color: var(--muted); font: 400 14px/1 var(--font-mono); }
.m2-paused { margin: 0; padding: 12px 16px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.m2-msg { margin: 0; min-height: 1.6em; font-size: 14px; color: var(--muted); }
.m2-msg.is-bad { color: #fca5a5; }
.m2-dl { margin: 0; font-size: 14px; }

.m2-recent { grid-column: 1 / -1; }
.m2-recent-title { font: 700 18px/1.2 var(--font-head); margin: 8px 0 12px; }
.m2-recent-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.m2-recent-list video { width: 100%; border-radius: 8px; background: #000; }
.pay-note { margin-top: 16px; padding: 12px 16px; border-radius: 8px; border: 1px solid var(--accent); }

/* prose */
.prose { max-width: 70ch; }
.prose h2 { font-size: 28px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 16px; }
.prose li { margin-bottom: 8px; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 24px; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { color: var(--muted); font-weight: 600; }
.prose code { font-family: var(--font-mono); font-size: 14px; background: var(--card); padding: 2px 4px; border-radius: 4px; }
.prose blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 2px solid var(--accent); background: var(--card); border-radius: 0 8px 8px 0; color: var(--muted); }

/* faq */
.faq { max-width: 70ch; margin-top: 48px; }
.faq-item { border-bottom: 1px solid var(--line); padding: 16px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; font-size: 18px; }
.faq-item p { margin: 12px 0 0; color: var(--muted); }

/* inner pages */
.page { padding-top: 32px; }
.page-head { max-width: 70ch; margin-bottom: 24px; }
.page-head .meta, .tc { color: var(--muted); font: 400 14px/1.6 var(--font-mono); }
.page-404 { min-height: 40vh; }

@media (max-width: 900px) {
  .m2 { grid-template-columns: 1fr; }
  .m2-monitor { position: static; }
  .m2-recent-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  h1 { font-size: 30px; }
  h2, .prose h2 { font-size: 22px; }
  .lede { font-size: 16px; }
  .nav { gap: 16px; }
  .m2-monitor { padding: 8px; }
  .m2-deck { padding: 16px; }
  .m2-tabs button { font-size: 12px; }
  .m2-frames { grid-template-columns: 1fr; }
  .m2-go { width: 100%; }
  .m2-recent-list { grid-template-columns: 1fr; }
  .hud { font-size: 12px; letter-spacing: 0; }
  .m2-idle, .m2-busy { padding: 24px 16px; }
  .m2-idle-title { font-size: 16px; margin: 0; }
  .m2-idle-sub, .m2-busy-sub { display: none; }
  .cm { width: 12px; height: 12px; }
  .cm-tl, .cm-tr { top: 18%; }
  .cm-bl, .cm-br { bottom: 18%; }
}
