:root {
  --bg: #121c17;
  --bg-2: #18251f;
  --panel: #1d2c25;
  --panel-2: #24362d;
  --line: #2f4539;
  --text: #e9e4d4;
  --muted: #9fae9f;
  --faint: #6f8174;
  --lamp: #f3c55b;
  --lamp-ink: #2a1f04;
  --card: #f6efd9;
  --card-ink: #2b2a22;
  --card-muted: #6d6857;
  --danger: #ef6f5e;
  --ok: #7fd18b;
  --radius: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --col-spark: #f3c55b;
  --col-exploring: #6fb7e8;
  --col-keeper: #7fd18b;
  --col-cut: #8b8f88;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
body { -webkit-font-smoothing: antialiased; }
a { color: var(--lamp); }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #f3c55b55; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2);
  padding: 7px 13px; border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; color: var(--text); font-size: 14px; }
.btn:hover { border-color: #4a6656; background: #2b4136; }
.btn.primary { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); font-weight: 600; }
.btn.primary:hover { background: #ffd472; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.input, select.input, textarea.input { width: 100%; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; outline: none; }
.input:focus { border-color: var(--lamp); box-shadow: 0 0 0 3px #f3c55b22; }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.err { color: var(--danger); min-height: 1.4em; font-size: 14px; }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 30% 0%, #26402f 0%, transparent 60%), var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: 0 30px 80px #0008; }
.auth-card h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 4px; }
.auth-card p.lead { color: var(--muted); margin: 0 0 22px; }
.brand-mark { width: 44px; height: 44px; margin-bottom: 14px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }
.side { background: var(--bg-2); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.side-head img { width: 30px; height: 30px; }
.side-head .name { font-family: var(--serif); font-size: 19px; font-weight: 600; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { padding: 4px 8px; }
.nav a, .nav button.navlink { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 7px; color: var(--muted);
  text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; font-size: 14px; }
.nav a:hover, .nav button.navlink:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel-2); color: var(--text); }
.nav .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--faint); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 14px 18px 4px; display: flex; align-items: center; }
.nav-label button { margin-left: auto; }
.side-scroll { overflow-y: auto; flex: 1; padding-bottom: 10px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; align-items: center; gap: 8px; }
.main { overflow-y: auto; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #1a1a1a; flex: none; position: relative; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.online::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-2); }
.avatar.sm.online::after { width: 7px; height: 7px; border-width: 1.5px; }
.avatar.nodot::after { display: none; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; border: 2px solid var(--bg); }
.avatars .avatar:first-child { margin-left: 0; }

/* ---------- pages ---------- */
.page { padding: 28px 34px 60px; max-width: 1200px; width: 100%; }
.page.wide { max-width: none; }
.page-title { font-family: var(--serif); font-size: 32px; font-weight: 600; margin: 0; line-height: 1.15; }
.section-title { font-family: var(--serif); font-size: 20px; font-weight: 600; margin: 30px 0 12px; }

.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 18px; }
.game-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 16px 14px; cursor: pointer; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; transition: transform .12s, border-color .12s; min-height: 150px; }
.game-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--c); }
.game-card:hover { transform: translateY(-2px); border-color: #4a6656; }
.game-card h3 { margin: 4px 0 0; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.game-card p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.game-card .meta { margin-top: auto; display: flex; gap: 12px; font-size: 12px; color: var(--faint); }
.game-card.archived { opacity: .55; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); text-transform: lowercase; }
.chip.status-prototyping { color: #6fb7e8; border-color: #6fb7e855; }
.chip.status-in-development { color: var(--lamp); border-color: #f3c55b55; }
.chip.status-released { color: var(--ok); border-color: #7fd18b55; }
.chip.status-shelved { color: var(--faint); }
.new-card { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); background: transparent; }
.new-card::before { display: none; }

.home-grid { display: grid; grid-template-columns: 1fr 340px; gap: 30px; align-items: start; }
.spark-box { background: linear-gradient(160deg, #2b3d2f, #1d2c25); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.spark-box h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 17px; }
.spark-text { font-family: var(--serif); font-size: 19px; line-height: 1.4; margin: 12px 0 14px; color: var(--card); min-height: 80px; }
.spark-text b { color: var(--lamp); font-weight: 600; }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #2f453966; font-size: 14px; }
.feed li .txt { flex: 1; min-width: 0; color: var(--muted); }
.feed li .txt b { color: var(--text); font-weight: 600; }
.feed li .txt a { color: var(--text); text-decoration: none; }
.feed li .txt a:hover { text-decoration: underline; }
.feed li time { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ---------- project ---------- */
.proj-head { padding: 22px 30px 0; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, transparent), transparent); }
.proj-head .page-title { outline: none; border-radius: 6px; }
.proj-head .page-title[contenteditable="true"]:focus { box-shadow: 0 0 0 2px var(--lamp); }
.pitch { color: var(--muted); max-width: 780px; margin: 6px 0 0; outline: none; border-radius: 6px; padding: 2px 0; min-height: 1.5em; white-space: pre-wrap; }
.pitch:empty::before { content: 'Add a one-line pitch…'; color: var(--faint); }
.pitch:focus { box-shadow: 0 0 0 2px var(--lamp); color: var(--text); }
.proj-meta { display: flex; gap: 8px; align-items: center; margin: 12px 0 0; flex-wrap: wrap; }
.proj-meta select, .proj-meta input { background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; font-size: 13px; }
.tabs { display: flex; gap: 2px; margin-top: 16px; }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-size: 14px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--lamp); }
.tabs a:hover { color: var(--text); }

.board-tools { display: flex; gap: 10px; align-items: center; padding: 14px 30px; flex-wrap: wrap; }
.board-tools .input { width: 220px; padding: 6px 10px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 14px; padding: 0 30px 40px; align-items: start; overflow-x: auto; }
.col { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 200px; transition: background .1s; }
.col.drop { background: #22352b; border-color: var(--lamp); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.col-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.col-head .n { color: var(--faint); font-size: 12px; }
.col-head .pip { width: 8px; height: 8px; border-radius: 50%; }
.col-hint { font-size: 12px; color: var(--faint); margin: -6px 4px 10px; }
.quick-add { display: flex; gap: 6px; margin-bottom: 10px; }
.quick-add .input { padding: 7px 10px; font-size: 14px; }
.cards { display: flex; flex-direction: column; gap: 8px; min-height: 40px; }
.card { background: var(--card); color: var(--card-ink); border-radius: 8px; padding: 10px 11px 9px; cursor: pointer; box-shadow: 0 1px 0 #0003, 0 4px 14px #0002;
  border-top: 3px solid var(--colc, var(--lamp)); position: relative; user-select: none; }
.card:hover { box-shadow: 0 1px 0 #0003, 0 8px 22px #0004; }
.card.dragging { opacity: .4; }
.card.cut { opacity: .7; }
.card .title { font-weight: 600; font-size: 15px; line-height: 1.35; word-wrap: break-word; }
.card .snippet { color: var(--card-muted); font-size: 13px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .thumb { width: calc(100% + 22px); margin: -10px -11px 8px; height: 110px; object-fit: cover; border-radius: 5px 5px 0 0; display: block; }
.card .foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--card-muted); }
.card .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px; }
.tag { font: 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: #2b2a2214; color: #4d4a3c; }
.tag.dark { background: var(--panel-2); color: var(--muted); }
.vote { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #2b2a2226; background: transparent; border-radius: 99px; padding: 1px 8px 1px 6px; cursor: pointer; font-size: 12px; color: var(--card-muted); }
.vote:hover { border-color: #2b2a2266; color: var(--card-ink); }
.vote.on { background: #e9a91d; border-color: #e9a91d; color: #2a1f04; font-weight: 700; }
.card .who { margin-left: auto; }
.empty-col { color: var(--faint); font-size: 13px; text-align: center; padding: 18px 6px; border: 1px dashed var(--line); border-radius: 8px; }

/* ---------- design doc ---------- */
.doc { display: grid; grid-template-columns: 230px 1fr; gap: 0; flex: 1; min-height: 0; }
.doc-nav { border-right: 1px solid var(--line); padding: 16px 10px; }
.doc-nav .pg { display: flex; align-items: center; gap: 4px; border-radius: 7px; }
.doc-nav .pg a { flex: 1; padding: 6px 10px; color: var(--muted); text-decoration: none; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-nav .pg:hover { background: var(--panel); }
.doc-nav .pg.active { background: var(--panel-2); }
.doc-nav .pg.active a { color: var(--text); }
.doc-nav .pg .mv { display: none; }
.doc-nav .pg:hover .mv { display: inline-flex; }
.mv button { background: none; border: 0; color: var(--faint); cursor: pointer; padding: 2px 4px; font-size: 12px; }
.mv button:hover { color: var(--text); }
.doc-body { padding: 24px 40px 60px; min-width: 0; }
.doc-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.doc-title-input { font-family: var(--serif); font-size: 30px; font-weight: 600; background: transparent; border: 0; outline: none; width: 100%; padding: 0; margin-bottom: 8px; }
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.editor textarea { min-height: 60vh; font: 14px/1.6 var(--mono); background: var(--bg-2); }
.editor .preview { border-left: 1px solid var(--line); padding-left: 20px; max-height: 75vh; overflow-y: auto; }
.save-state { font-size: 12px; color: var(--faint); }
.save-state.dirty { color: var(--lamp); }
.banner { background: #3a2f12; border: 1px solid #7a6426; color: #f8e3a8; padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 14px; }

.prose { max-width: 760px; font-size: 16px; line-height: 1.65; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); font-weight: 600; line-height: 1.25; margin: 1.4em 0 .5em; }
.prose h1 { font-size: 28px; } .prose h2 { font-size: 22px; } .prose h3 { font-size: 18px; } .prose h4 { font-size: 16px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li.task { list-style: none; margin-left: -1.3em; }
.prose li.task input { accent-color: var(--lamp); margin-right: 4px; }
.prose code { font: 13px var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--bg-2); border: 1px solid var(--line); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--lamp); padding: 2px 0 2px 14px; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--panel); }
.prose.on-card { color: var(--card-ink); font-size: 15px; }
.prose.on-card code { background: #2b2a2214; }
.prose.on-card blockquote { color: var(--card-muted); border-color: #c79a2b; }
.prose.on-card a { color: #8a5a00; }

/* ---------- comments ---------- */
.comments { margin-top: 28px; max-width: 760px; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #2f453966; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { font-size: 13px; color: var(--faint); display: flex; gap: 8px; align-items: baseline; }
.comment .c-head b { color: var(--text); font-size: 14px; }
.comment .c-head button { margin-left: auto; background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 12px; }
.comment .c-head button:hover { color: var(--danger); }
.comment .prose { font-size: 14px; }
.comment-form { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.comment-form textarea { min-height: 42px; height: 42px; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: #050a07b8; display: grid; place-items: start center; padding: 5vh 16px; overflow-y: auto; z-index: 50; animation: fade .12s; }
.modal { width: min(820px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 30px 90px #000a; animation: rise .16s; }
.modal.narrow { width: min(460px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; flex: 1; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); }
.x { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; padding: 2px 6px; }
.x:hover { color: var(--text); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.idea-modal { display: grid; grid-template-columns: 1fr 230px; }
.idea-main { padding: 18px 20px; background: var(--card); color: var(--card-ink); border-radius: 0 0 0 14px; min-width: 0; }
.idea-main .input { background: #fffaf0; border-color: #d8ceb2; color: var(--card-ink); }
.idea-main .input:focus { border-color: #c79a2b; box-shadow: 0 0 0 3px #c79a2b33; }
.idea-title { font-family: var(--serif); font-size: 26px; font-weight: 600; border: 0 !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; }
.idea-side { padding: 18px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; font-size: 14px; }
.idea-side h5 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.seg { display: flex; gap: 6px; margin: 4px 0 6px; }
.seg button { background: none; border: 0; padding: 2px 0; color: var(--card-muted); cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; }
.seg button.on { color: var(--card-ink); border-bottom-color: #c79a2b; }
.col-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.col-pick button { border: 1px solid var(--line); background: var(--bg-2); border-radius: 7px; padding: 6px; cursor: pointer; font-size: 13px; color: var(--muted); }
.col-pick button.on { border-color: var(--colc); color: var(--text); background: color-mix(in srgb, var(--colc) 18%, var(--bg-2)); }
.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.images figure { margin: 0; position: relative; }
.images img { width: 100%; height: 90px; object-fit: cover; border-radius: 6px; cursor: zoom-in; display: block; border: 1px solid #d8ceb2; }
.images figure button { position: absolute; top: 4px; right: 4px; background: #000a; color: #fff; border: 0; border-radius: 4px; cursor: pointer; font-size: 12px; padding: 1px 6px; display: none; }
.images figure:hover button { display: block; }
.dropzone { border: 1px dashed #c9bd9a; border-radius: 8px; padding: 10px; text-align: center; font-size: 13px; color: var(--card-muted); cursor: pointer; margin-top: 10px; }
.dropzone.over { background: #f3c55b33; border-color: #c79a2b; }
.idea-main .comments { margin-top: 22px; }
.idea-main .comment { border-color: #d8ceb2; }
.idea-main .comment .c-head b { color: var(--card-ink); }
.idea-main .comment .c-head { color: var(--card-muted); }
.lightbox { position: fixed; inset: 0; background: #000d; z-index: 80; display: grid; place-items: center; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ---------- team ---------- */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 160px; }
.code-box { font: 13px var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; word-break: break-all; flex: 1; min-width: 200px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--text); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #2c4236; border: 1px solid #4a6656; padding: 9px 16px; border-radius: 9px; box-shadow: 0 10px 30px #0008; font-size: 14px; animation: rise .15s; }
.toast.error { background: #4a2420; border-color: #8a3f35; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .home-grid { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(4, 260px); }
  .editor { grid-template-columns: 1fr; }
  .editor .preview { display: none; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .18s; box-shadow: 20px 0 50px #0008; }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ''; position: fixed; inset: 0; background: #0007; z-index: 30; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg-2); position: sticky; top: 0; z-index: 20; }
  .topbar .name { font-family: var(--serif); font-size: 18px; font-weight: 600; flex: 1; }
  .page { padding: 20px 16px 50px; }
  .proj-head { padding: 16px 16px 0; }
  .board-tools { padding: 12px 16px; }
  .board-tools .small.faint { display: none; }
  .board { padding: 0 16px 30px; grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .doc { grid-template-columns: 1fr; }
  .doc-nav { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; gap: 4px; padding: 10px; }
  .doc-nav .pg a { white-space: nowrap; }
  .doc-nav .pg .mv, .doc-nav .nav-label { display: none !important; }
  .doc-body { padding: 18px 16px 50px; }
  .idea-modal { grid-template-columns: 1fr; }
  .idea-main { border-radius: 0; }
  .idea-side { border-left: 0; border-top: 1px solid var(--line); }
  .modal-back { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .page-title { font-size: 26px; }
}

/* ---------- storyboard ---------- */
.story .doc-nav { width: 230px; }
.sb-pg a { display: flex !important; align-items: center; gap: 9px; padding: 6px 8px !important; }
.sb-mini { width: 44px; flex: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; max-height: 44px; }
.sb-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-pg-txt { display: flex; flex-direction: column; min-width: 0; }
.sb-pg-txt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-pg-txt small { color: var(--faint); font-size: 11px; }
.sb-desc { flex: 1; min-width: 220px; min-height: 40px !important; height: 40px; font-size: 14px; }
.seg-dark { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg-dark button { background: transparent; border: 0; color: var(--muted); padding: 3px 9px; cursor: pointer; font-size: 12px; }
.seg-dark button.on { background: var(--panel-2); color: var(--text); }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--fw, 250px), 1fr)); gap: 16px; align-items: start; }
.sb-frame { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; position: relative; transition: border-color .12s, transform .12s; }
.sb-frame:hover { border-color: #4a6656; }
.sb-frame.dragging { opacity: .35; }
.sb-frame.drop-before { box-shadow: -4px 0 0 var(--lamp); }
.sb-frame.drop-after { box-shadow: 4px 0 0 var(--lamp); }
.sb-frame.flash { animation: flash 1.2s; }
@keyframes flash { 0% { border-color: var(--lamp); box-shadow: 0 0 0 3px #f3c55b66; } }
.sb-pic { position: relative; aspect-ratio: var(--ar, 16/9); background: #fbf8f0; display: grid; place-items: center; overflow: hidden; }
.sb-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-pic.big { border-radius: 10px; border: 1px solid var(--line); cursor: crosshair; }
.sb-pic.big.over { outline: 3px dashed var(--lamp); }
.sb-blank { color: #9b9480; text-align: center; font-size: 14px; padding: 10px; background: repeating-linear-gradient(135deg, transparent 0 12px, #00000008 12px 13px); width: 100%; height: 100%; display: grid; place-content: center; }
.sb-blank small { font-size: 12px; opacity: .8; }
.sb-num { position: absolute; top: 7px; left: 7px; background: #14211bdd; color: var(--text); font: 600 12px var(--mono); padding: 2px 7px; border-radius: 5px; }
.sb-dur { position: absolute; bottom: 7px; right: 7px; background: #14211bcc; color: var(--muted); font: 11px var(--mono); padding: 1px 6px; border-radius: 4px; }
.sb-acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.sb-frame:hover .sb-acts { opacity: 1; }
.sb-acts button { background: #14211bdd; border: 1px solid #ffffff22; color: var(--text); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: 13px; }
.sb-acts button:hover { background: var(--lamp); color: var(--lamp-ink); }
.sb-meta { padding: 9px 11px 11px; display: flex; flex-direction: column; gap: 5px; }
.sb-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.sb-cap { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sb-dia { font-size: 13px; color: var(--muted); font-style: italic; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-add { display: grid; place-content: center; text-align: center; color: var(--muted); border-style: dashed; background: transparent; aspect-ratio: var(--ar, 16/9); font-size: 14px; gap: 4px; }
.sb-add span { font-size: 28px; line-height: 1; }
.sb-add:hover { color: var(--text); }
.sb-empty { max-width: 560px; margin: 30px auto; text-align: center; }
.sb-empty p { line-height: 1.6; }
.sb-empty-art { display: flex; justify-content: center; gap: 10px; margin-bottom: 20px; }
.sb-empty-art div { width: 92px; aspect-ratio: 16/9; background: #fbf8f0; border-radius: 6px; box-shadow: 0 6px 18px #0006; }
.sb-modal { width: min(1100px, 100%); }
.sb-edit { display: grid; grid-template-columns: 1fr 320px; gap: 20px; padding: 18px; }
.sb-edit-right textarea.input { min-height: 0; }
.sb-aspects { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.sb-aspects label { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: var(--muted); }
.sb-aspects input { display: none; }
.sb-asp-box { width: 48px; max-height: 60px; border: 2px solid var(--line); border-radius: 4px; background: var(--bg-2); }
.sb-aspects input:checked + .sb-asp-box { border-color: var(--lamp); background: #f3c55b22; }
.sb-aspects input:checked ~ small { color: var(--text); }

/* ---------- sketch pad ---------- */
.sk { position: fixed; inset: 0; z-index: 90; background: #0d1410; display: flex; flex-direction: column; }
.sk-bar { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 8px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.sk-group { display: flex; align-items: center; gap: 4px; }
.sk-title { font-family: var(--serif); font-weight: 600; font-size: 16px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-end { margin-left: auto; }
.sk-tool { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-size: 16px; }
.sk-tool.on { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); }
.sk-color { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #ffffff33; cursor: pointer; padding: 0; }
.sk-color.on { outline: 2px solid var(--lamp); outline-offset: 2px; }
.sk-custom { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; border: 2px solid #ffffff33; cursor: pointer; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.sk-custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.sk-label { font-size: 12px; color: var(--muted); }
.sk-size { width: 100px; accent-color: var(--lamp); }
.sk-sizeval { font: 12px var(--mono); color: var(--muted); width: 18px; }
.sk-btn, .sk-toggle { border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 13px; white-space: nowrap; }
.sk-btn:hover, .sk-toggle:hover { background: var(--panel-2); }
.sk-btn:disabled { opacity: .4; cursor: default; }
.sk-toggle.on, .sk-btn.on { border-color: var(--lamp); color: var(--lamp); }
.sk-save { background: var(--lamp); color: var(--lamp-ink); border-color: var(--lamp); font-weight: 600; }
.sk-save:hover { background: #ffd472; }
.sk-stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.sk-stage { position: relative; box-shadow: 0 20px 60px #000a; touch-action: none; }
.sk-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sk-onion { opacity: .25; pointer-events: none; }
.sk-grid { pointer-events: none; }
.sk-prev { touch-action: none; }
.sk-text { position: absolute; z-index: 5; background: #ffffffee; border: 1px dashed #2f80ed; outline: none; font-weight: 600; padding: 0 4px; min-width: 120px; transform: translateY(-2px); }
.sk-hint { text-align: center; font-size: 12px; color: var(--faint); padding: 6px 10px 10px; }

/* ---------- animatic player ---------- */
.player { position: fixed; inset: 0; z-index: 85; background: #050806; display: flex; flex-direction: column; color: var(--text); }
.pl-top, .pl-ctl { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.pl-ctl { justify-content: center; padding-bottom: 18px; }
.pl-play { min-width: 64px; font-size: 16px; }
.pl-stage-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 10px 20px; }
.pl-stage { position: relative; background: #fbf8f0; overflow: hidden; border-radius: 4px; }
#pl-pic, #pl-pic img { width: 100%; height: 100%; display: block; object-fit: cover; }
.pl-card { width: 100%; height: 100%; display: grid; place-items: center; text-align: center; padding: 8%; font-family: var(--serif); font-size: clamp(18px, 3vw, 34px); color: #2b2a22; background: #fbf8f0; }
.pl-sub { position: absolute; left: 0; right: 0; bottom: 6%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 6%; }
.pl-sub span { background: #000c; color: #fff; padding: 4px 12px; border-radius: 4px; font-size: clamp(13px, 1.6vw, 20px); text-align: center; }
.pl-shot { position: absolute; top: 10px; left: 10px; font: 11px var(--mono); color: #fff; background: #0008; padding: 2px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; }
.pl-shot:empty { display: none; }
.pl-bar { display: flex; gap: 3px; padding: 0 20px; cursor: pointer; }
.pl-seg { height: 8px; background: #ffffff22; border-radius: 2px; overflow: hidden; min-width: 4px; }
.pl-seg i { display: block; height: 100%; width: 0; background: var(--lamp); }
.pl-seg:hover { background: #ffffff44; }

/* ---------- print sheet ---------- */
#print-root { display: none; }
@media print {
  @page { size: landscape; margin: 12mm; }
  body > *:not(#print-root) { display: none !important; }
  html, body { background: #fff !important; color: #111 !important; height: auto; }
  #print-root { display: block; font: 10pt/1.35 var(--sans); color: #111; }
}
#print-root .ps-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 10px; }
#print-root .ps-game { font-size: 9pt; text-transform: uppercase; letter-spacing: .1em; color: #666; }
#print-root h1 { font-family: var(--serif); font-size: 20pt; margin: 0; }
#print-root .ps-head p { margin: 2px 0 0; color: #444; max-width: 160mm; }
#print-root .ps-info { text-align: right; color: #555; font-size: 9pt; }
#print-root .ps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8mm 6mm; }
#print-root .ps-grid.portrait { grid-template-columns: repeat(5, 1fr); }
#print-root .ps-frame { break-inside: avoid; }
#print-root .ps-pic { border: 1.5px solid #111; background: #fff; overflow: hidden; }
#print-root .ps-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
#print-root .ps-line { display: flex; gap: 8px; font-size: 8.5pt; color: #555; margin-top: 3px; }
#print-root .ps-line b { color: #111; }
#print-root .ps-line span:last-child { margin-left: auto; }
#print-root .ps-cap { margin-top: 2px; }
#print-root .ps-dia { font-style: italic; color: #333; margin-top: 2px; }
#print-root .ps-notes { font-size: 8.5pt; color: #666; margin-top: 2px; white-space: pre-wrap; }
#print-root.preview { display: block; background: #fff; color: #111; padding: 20px; }

@media (max-width: 1000px) { .sb-edit { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .story .doc-nav { width: auto; }
  .sb-pg .sb-mini { display: none; }
  .sb-grid { grid-template-columns: repeat(auto-fill, minmax(min(var(--fw), 42vw), 1fr)); gap: 10px; }
  .sb-acts { opacity: 1; }
  .sk-title, .sk-hint { display: none; }
}
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs a { white-space: nowrap; }
@media (max-width: 760px) {
  .story .doc-nav { align-items: center; }
  .story .doc-nav .pg, .story .doc-nav .btn { flex: none; }
  .sb-pg a { max-width: 220px; }
  .sb-acts button { width: 24px; height: 24px; font-size: 11px; }
  .sb-blank small { display: none; }
}
@media (max-width: 760px) { .doc { display: block; } .doc-nav { padding: 10px 12px; } }
