:root {
  --bg: #0f1014; --panel: #181a21; --line: #2a2d38; --text: #f3f4f7; --muted: #9a9fb0;
  --accent: #0c9a72; --accent2: #5ee8b5; --ok: #3ecf8e; --warn: #ffb23f; --bad: #ff6b6b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 Inter, system-ui, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
:root { color-scheme: dark; }
.scene select { margin-bottom: 4px; padding: 6px 10px; font-size: 13px; }
.top { display: flex; align-items: baseline; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
a { color: var(--accent2); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.brand { font-weight: 700; font-size: 22px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { border-radius: 7px; }
.tag { margin: 0; color: var(--muted); font-size: 15px; font-weight: 400; }
.nav { margin-left: auto; display: flex; gap: 18px; }
.nav a, .foot a { color: var(--muted); text-decoration: none; }
.nav a:hover, .foot a:hover { color: var(--text); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; padding: 20px 24px; max-width: 1400px; margin: 0 auto; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; min-width: 0; }
.stage { position: sticky; top: 16px; align-self: start; }
h2 { font-size: 16px; margin: 22px 0 12px; display: flex; align-items: center; gap: 10px; }
h2:first-child { margin-top: 0; }
.n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 13px; }
label { display: block; margin-bottom: 12px; font-weight: 500; font-size: 14px; }
label small { color: var(--muted); font-weight: 400; }
input:not([type]), input[type=text], input[type=password], textarea, select { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; background: #0f1117; border: 1px solid var(--line); border-radius: 10px; outline: none; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
input[type=file] { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=color] { display: block; margin-top: 6px; width: 64px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: none; padding: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.thumbs img, .thumbs video { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chips button { background: #0f1117; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; text-align: left; }
.chips button small { display: block; color: var(--muted); font-size: 11px; }
.chips button.on, .modes button.on { border-color: var(--accent); background: rgba(46, 220, 160, .12); }
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.avatar-pick { display: flex; gap: 12px; align-items: flex-start; }
.avatar-pick img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.avatar-pick div { flex: 1; min-width: 0; }
.modes button { background: #0f1117; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.modes span { color: var(--muted); font-size: 13px; flex: 1; }
.modes em { font-style: normal; font-size: 12px; font-weight: 600; align-self: flex-start; padding: 2px 8px; border-radius: 999px; }
.free { background: rgba(62, 207, 142, .15); color: var(--ok); }
.cheap { background: rgba(255, 178, 63, .15); color: var(--warn); }
.pricey { background: rgba(255, 107, 107, .15); color: var(--bad); }
.premium { background: rgba(201, 162, 39, .18); color: #f2c94c; }
.modes button.locked { opacity: .78; }
#modeExtra { margin-top: 12px; }
.credit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #0f1117; }
.credit-bar span { margin-right: auto; }
.buy-box { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0f1117; }
.buy-box .row { display: flex; gap: 8px; }
.buy-box .row input { flex: 1; min-width: 0; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.packs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px; background: #161922; color: inherit; cursor: pointer; }
.packs button:hover { border-color: var(--accent); }
.packs b { font-size: 20px; }
.packs span { color: var(--muted); font-size: 13px; }
.packs em { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; }
.note { font-size: 13px; color: var(--muted); background: #0f1117; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.primary { background: linear-gradient(135deg, #10a97c, #0a8565); border: 0; color: #fff; font-weight: 600; border-radius: 12px; padding: 12px 18px; cursor: pointer; }
.primary:disabled, .controls button:disabled { opacity: .45; cursor: not-allowed; }
.wide-btn { width: 100%; margin-top: 18px; font-size: 16px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #0f1117; border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 18px; }
.tabs button { background: none; border: 0; border-radius: 9px; padding: 10px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; }
.big-label { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 14px; }
.upload { display: flex; gap: 12px; align-items: center; border: 1.5px dashed var(--line); border-radius: 14px; padding: 14px 16px; cursor: pointer; background: #0f1117; }
.upload:hover, .upload:focus-within { border-color: var(--accent2); }
.upload-icon { font-size: 28px; }
.upload small { color: var(--muted); font-weight: 400; }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.big-btn { font-size: 18px; padding: 16px 18px; }
details.more { border: 1px solid var(--line); border-radius: 14px; padding: 4px 16px; margin-top: 14px; background: #13151b; }
details.more[open] { padding-bottom: 16px; }
details.more summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
details.more summary small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.group-label { font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 8px; }
#prompt { font-size: 16px; line-height: 1.5; }
#quick .note { margin-top: 10px; }
.status { min-height: 1.4em; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.status.err { color: var(--bad); }
.screen { position: relative; background: #07080b; border-radius: 12px; display: flex; align-items: center; justify-content: center; height: min(62vh, 640px); min-height: 320px; overflow: hidden; padding: 10px; }
canvas { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; border-radius: 6px; }
.placeholder { position: absolute; color: var(--muted); text-align: center; padding: 20px; }
.ph-title { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 10px; }
.ph-steps { text-align: left; display: inline-block; margin: 0 0 16px; padding-left: 20px; line-height: 1.8; }
#tryExample { display: block; margin: 0 auto; }
.try-line { text-align: center; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent2); font-weight: 600; cursor: pointer; text-decoration: underline; }
.controls { display: flex; gap: 10px; margin-top: 12px; }
.controls button:not(.primary) { background: #0f1117; border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; cursor: pointer; }
.controls button { flex: 1; }
.controls #export { flex: 1.4; }
.progress { height: 6px; background: #0f1117; border-radius: 3px; margin-top: 10px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.download { display: block; text-align: center; margin-top: 10px; padding: 12px; border-radius: 12px; background: rgba(62, 207, 142, .15); color: var(--ok); font-weight: 600; text-decoration: none; }
.scenes { margin-top: 16px; display: grid; gap: 10px; }
.scene { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #0f1117; }
.scene header { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; gap: 8px; }
.scene header .st { color: var(--warn); }
.scene header .st.ok { color: var(--ok); }
.scene header .st.err { color: var(--bad); }
.scene input, .scene textarea { margin-top: 4px; padding: 7px 10px; font-size: 14px; }
.scene textarea { min-height: 0; }
.credits { color: var(--muted); font-size: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 16px 30px; }
.foot nav { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 6px; }
.foot p { margin: 4px 0; }
/* text pages: about, faq, privacy, terms, 404 */
.doc { max-width: 760px; margin: 0 auto; padding: 28px 20px 40px; }
.doc h1 { font-size: 34px; letter-spacing: -.02em; margin: 6px 0 4px; }
.doc h2 { font-size: 20px; margin: 30px 0 8px; display: block; }
.doc h3 { font-size: 16px; margin: 20px 0 6px; }
.doc p, .doc li { color: #d6d9e2; }
.doc .muted { color: var(--muted); }
.doc table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.doc th, .doc td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--muted); font-weight: 600; }
.doc details { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 10px 0; background: var(--panel); }
.doc summary { font-weight: 600; cursor: pointer; }
.cta-btn { display: inline-block; margin-top: 16px; text-decoration: none; }
@media (max-width: 600px) {
  .doc table, .doc tbody, .doc tr, .doc td { display: block; }
  .doc thead { display: none; }
  .doc tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .doc td { border: 0; padding: 2px 0; }
  .doc td:first-child { font-weight: 700; }
  .doc td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-weight: 600; }
  .nav { margin-left: 0; width: 100%; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .stage { position: static; }
  .modes { grid-template-columns: 1fr; }
}
@media (max-width: 520px) { .row { grid-template-columns: 1fr; } .top { padding: 14px 16px; } }
