:root {
  --bg: #0a0a0b; --surface: #131316; --surface2: #1a1a1e; --border: #232328;
  --text: #e8e8ea; --dim: #71717a;
  --vex: #ff2d95; --glim: #00e5ff; --patch: #ffd60a; --rook: #a855f7;
  --fizz: #ff1493; --nox: #39ff14; --scrap: #ff6b1a;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-font-smoothing: antialiased; }
body { background: var(--bg); color: var(--text); font-family: "Geist Sans", ui-sans-serif, system-ui, sans-serif; min-height: 100vh; }

/* Gate */
.gate { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 1000; background: var(--bg); }
.gate.hidden { display: none; }
.gate-logo { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 24px; }
.gate h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: 0.05em; margin-bottom: 8px; }
.gate p { color: var(--dim); font-size: 0.85rem; margin-bottom: 24px; text-align: center; max-width: 360px; }
.gate-input { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; color: var(--text); font-size: 0.9rem; width: 280px; text-align: center; font-family: "Geist Mono", ui-monospace, monospace; outline: none; transition: border-color 0.15s; }
.gate-input:focus { border-color: var(--vex); }
.gate-btn { margin-top: 16px; background: var(--vex); color: #fff; border: none; border-radius: 10px; padding: 12px 32px; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: transform 0.15s; }
.gate-btn:hover { transform: translateY(-1px); }
.gate-error { color: #ef4444; font-size: 0.8rem; margin-top: 12px; display: none; }
.gate-error.show { display: block; }

/* Studio content */
.studio { display: none; padding: 0; }
.studio.visible { display: block; }
.nav { position: sticky; top: 0; z-index: 100; background: rgba(10,10,11,0.9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-brand { display: flex; align-items: center; gap: 10px; }
.nav-brand img { width: 28px; height: 28px; border-radius: 6px; }
.nav-brand span { font-weight: 800; font-size: 1rem; letter-spacing: 0.05em; }
.nav-badge { font-size: 0.65rem; background: var(--nox); color: #0a0a0b; padding: 2px 8px; border-radius: 4px; font-weight: 700; letter-spacing: 0.1em; }
.nav-links { display: flex; gap: 20px; flex-wrap: wrap; }
.nav-links a { color: var(--dim); text-decoration: none; font-size: 0.8rem; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }

.section { padding: 48px 24px; max-width: 1000px; margin: 0 auto; }
.section-label { font-size: 0.7rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.section-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 24px; }

/* Deployment table */
.dep-table { width: 100%; border-collapse: collapse; }
.dep-table th { text-align: left; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; border-bottom: 1px solid var(--border); }
.dep-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.dep-table td a { color: var(--glim); text-decoration: none; }
.dep-table td a:hover { text-decoration: underline; }
.dep-status { font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.dep-status.live { background: rgba(57,255,20,0.15); color: var(--nox); }

/* File tree */
.file-tree { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.8rem; line-height: 1.8; color: var(--dim); }
.file-tree .dir { color: var(--glim); }
.file-tree .file { color: var(--text); }
.file-tree .comment { color: var(--dim); font-style: italic; }

/* API cards */
.api-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.api-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.api-card h3 { font-size: 1rem; margin-bottom: 8px; }
.api-card .api-status { font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; display: inline-block; margin-bottom: 12px; }
.api-card .api-status.ready { background: rgba(57,255,20,0.15); color: var(--nox); }
.api-card .api-status.waiting { background: rgba(255,214,10,0.15); color: var(--patch); }
.api-card p { font-size: 0.8rem; color: var(--dim); line-height: 1.5; }
.api-card code { font-family: "Geist Mono", ui-monospace, monospace; font-size: 0.75rem; color: var(--glim); }

/* Checklist */
.checklist { list-style: none; }
.checklist li { padding: 8px 0; font-size: 0.85rem; display: flex; align-items: center; gap: 10px; }
.checklist li::before { content: '☐'; color: var(--dim); }
.checklist li.done::before { content: '☑'; color: var(--nox); }
.checklist li.done { color: var(--dim); text-decoration: line-through; }

/* Generation panel */
.gen-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.gen-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.gen-server-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 0.8rem; font-family: "Geist Mono", ui-monospace, monospace; flex: 1; min-width: 200px; outline: none; }
.gen-server-input:focus { border-color: var(--glim); }
.gen-server-label { font-size: 0.7rem; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; align-self: center; }
.gen-prompt { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; color: var(--text); font-size: 0.9rem; font-family: inherit; resize: vertical; min-height: 120px; outline: none; transition: border-color 0.15s; }
.gen-prompt:focus { border-color: var(--vex); }
.gen-prompt::placeholder { color: var(--dim); }
.gen-dna-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.gen-dna-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; color: var(--text); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; }
.gen-dna-btn:hover { transform: translateY(-1px); }
.gen-dna-btn[data-char="VEX"] { border-color: var(--vex); }
.gen-dna-btn[data-char="VEX"]:hover { background: rgba(255,45,149,0.15); }
.gen-dna-btn[data-char="GLIM"] { border-color: var(--glim); }
.gen-dna-btn[data-char="GLIM"]:hover { background: rgba(0,229,255,0.15); }
.gen-dna-btn[data-char="PATCH"] { border-color: var(--patch); }
.gen-dna-btn[data-char="PATCH"]:hover { background: rgba(255,214,10,0.15); }
.gen-dna-btn[data-char="ROOK"] { border-color: var(--rook); }
.gen-dna-btn[data-char="ROOK"]:hover { background: rgba(168,85,247,0.15); }
.gen-dna-btn[data-char="FIZZ"] { border-color: var(--fizz); }
.gen-dna-btn[data-char="FIZZ"]:hover { background: rgba(255,20,147,0.15); }
.gen-dna-btn[data-char="NOX"] { border-color: var(--nox); }
.gen-dna-btn[data-char="NOX"]:hover { background: rgba(57,255,20,0.15); }
.gen-dna-btn[data-char="SCRAP"] { border-color: var(--scrap); }
.gen-dna-btn[data-char="SCRAP"]:hover { background: rgba(255,107,26,0.15); }
.gen-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gen-btn { background: var(--vex); color: #fff; border: none; border-radius: 10px; padding: 12px 28px; font-weight: 700; font-size: 0.9rem; cursor: pointer; transition: transform 0.15s, opacity 0.15s; }
.gen-btn:hover { transform: translateY(-1px); }
.gen-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.gen-btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.gen-status { font-size: 0.8rem; color: var(--dim); margin-top: 16px; }
.gen-status.error { color: #ef4444; }
.gen-status.success { color: var(--nox); }
.gen-result { margin-top: 20px; display: none; }
.gen-result.show { display: block; }
.gen-result img { max-width: 100%; border-radius: 12px; border: 1px solid var(--border); }
.gen-result-meta { font-size: 0.75rem; color: var(--dim); margin-top: 8px; font-family: "Geist Mono", ui-monospace, monospace; }
.gen-history { margin-top: 24px; }
.gen-history-title { font-size: 0.8rem; color: var(--dim); margin-bottom: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.gen-history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gen-history-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); cursor: pointer; }
.gen-history-item img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gen-history-item .gen-history-prompt { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.8); padding: 6px 8px; font-size: 0.65rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 3D Model Generation */
.gen3d-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; margin-top: 24px; }
.gen3d-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.gen3d-tab { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 18px; color: var(--text); font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.gen3d-tab.active { background: var(--scrap); color: #0a0a0b; border-color: var(--scrap); }
.gen3d-tab:hover:not(.active) { border-color: var(--scrap); }
.gen3d-mode-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.gen3d-mode-btn { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; color: var(--text); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.gen3d-mode-btn.active { background: rgba(255,107,26,0.2); border-color: var(--scrap); color: var(--scrap); }
.gen3d-mode-btn:hover:not(.active) { border-color: var(--scrap); }
.gen3d-prompt { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; color: var(--text); font-size: 0.9rem; font-family: inherit; resize: vertical; min-height: 100px; outline: none; transition: border-color 0.15s; }
.gen3d-prompt:focus { border-color: var(--scrap); }
.gen3d-prompt::placeholder { color: var(--dim); }
.gen3d-url-input { width: 100%; background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; color: var(--text); font-size: 0.85rem; font-family: "Geist Mono", ui-monospace, monospace; outline: none; margin-bottom: 16px; }
.gen3d-url-input:focus { border-color: var(--scrap); }
.gen3d-url-input::placeholder { color: var(--dim); }
.gen3d-result { margin-top: 20px; display: none; }
.gen3d-result.show { display: block; }
.gen3d-result-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.gen3d-result-card h4 { font-size: 0.9rem; margin-bottom: 12px; }
.gen3d-result-links { display: flex; gap: 8px; flex-wrap: wrap; }
.gen3d-result-link { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px; color: var(--scrap); font-size: 0.75rem; font-weight: 600; text-decoration: none; transition: all 0.15s; font-family: "Geist Mono", ui-monospace, monospace; }
.gen3d-result-link:hover { background: rgba(255,107,26,0.15); }
.gen3d-result-thumb { width: 100%; max-width: 300px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 12px; }
.gen3d-result-meta { font-size: 0.75rem; color: var(--dim); margin-top: 8px; font-family: "Geist Mono", ui-monospace, monospace; }
.gen3d-refine-row { margin-top: 16px; display: none; }
.gen3d-refine-row.show { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.gen3d-refine-input { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: 0.8rem; flex: 1; min-width: 200px; outline: none; }
.gen3d-refine-input:focus { border-color: var(--scrap); }
.gen3d-history { margin-top: 24px; }
.gen3d-history-title { font-size: 0.8rem; color: var(--dim); margin-bottom: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.gen3d-history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.gen3d-history-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 0.7rem; }
.gen3d-history-item .gen3d-history-prompt { color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen3d-history-item .gen3d-history-status { color: var(--dim); font-family: "Geist Mono", ui-monospace, monospace; }

.footer { text-align: center; padding: 32px 24px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--dim); }

/* Persistent Gallery */
.gallery-section { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 32px; }
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.gallery-header h2 { font-size: 1.1rem; }
.gallery-count { font-size: 0.75rem; color: var(--dim); font-family: "Geist Mono", ui-monospace, monospace; }
.gallery-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.gallery-tab { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 16px; font-size: 0.8rem; color: var(--dim); cursor: pointer; transition: all 0.15s; }
.gallery-tab.active { background: var(--surface); color: var(--text); border-color: var(--glim); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.gallery-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: all 0.15s; position: relative; }
.gallery-card:hover { border-color: var(--glim); transform: translateY(-2px); }
.gallery-card img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery-card-3d { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: var(--surface); }
.gallery-card-3d-icon { font-size: 2rem; }
.gallery-card-info { padding: 10px 12px; }
.gallery-card-prompt { font-size: 0.7rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.gallery-card-meta { font-size: 0.6rem; color: var(--dim); font-family: "Geist Mono", ui-monospace, monospace; display: flex; justify-content: space-between; }
.gallery-card-badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); border-radius: 4px; padding: 2px 8px; font-size: 0.6rem; color: var(--text); font-family: "Geist Mono", ui-monospace, monospace; }
.gallery-card-links { display: none; position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.85); padding: 8px; flex-wrap: wrap; gap: 4px; }
.gallery-card:hover .gallery-card-links { display: flex; }
.gallery-card-link { font-size: 0.6rem; color: var(--scrap); text-decoration: none; padding: 2px 6px; border: 1px solid var(--border); border-radius: 4px; }
.gallery-empty { text-align: center; padding: 48px; color: var(--dim); font-size: 0.9rem; }

/* Gallery v2 — character + world organization */
.gallery-cat-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.gallery-sub-tabs { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; min-height: 32px; }
.gallery-sub-tab { background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 0.72rem; color: var(--dim); cursor: pointer; transition: all 0.15s; }
.gallery-sub-tab.active { color: var(--text); border-color: var(--glim); background: var(--surface); }
.gallery-sub-tab:hover { color: var(--text); }
.gallery-group-label { font-size: 0.65rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--dim); margin: 20px 0 10px; grid-column: 1/-1; }
.gallery-3d-viewer { width: 100%; aspect-ratio: 1; background: var(--surface); border-radius: 0; }
.gallery-3d-viewer model-viewer { width: 100%; height: 100%; --poster-color: var(--surface); }
.gallery-card-3d-fallback { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; background: var(--surface); font-size: 2rem; }
.gallery-modal { position: fixed; inset: 0; z-index: 999; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; padding: 40px; }
.gallery-modal.show { display: flex; }
.gallery-modal-close { position: absolute; top: 16px; right: 20px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; color: var(--text); font-size: 0.85rem; cursor: pointer; }
.gallery-modal-content { max-width: 700px; width: 100%; }
.gallery-modal-content img { max-width: 100%; border-radius: 12px; }
.gallery-modal-content model-viewer { width: 100%; height: 500px; background: var(--surface); border-radius: 12px; }
.gallery-modal-info { margin-top: 12px; font-size: 0.85rem; color: var(--dim); }

.gallery-delete { position: absolute; top: 8px; left: 8px; background: rgba(239,68,68,0.85); border: none; border-radius: 4px; padding: 4px 10px; font-size: 0.7rem; color: #fff; cursor: pointer; font-weight: 700; z-index: 3; }

/* Approval workflow */
.gallery-card.approved { border-color: var(--nox); box-shadow: 0 0 0 1px rgba(57,255,20,0.3); }
.gallery-card.rejected { border-color: #ef4444; opacity: 0.6; }
.gallery-card.pending-review { border-color: var(--patch); }
.gallery-approval-badge { position: absolute; top: 8px; left: 8px; border-radius: 4px; padding: 2px 8px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.05em; font-family: 'Geist Mono', ui-monospace, monospace; z-index: 2; }
.gallery-approval-badge.approved { background: rgba(57,255,20,0.85); color: #0a0a0b; }
.gallery-approval-badge.rejected { background: rgba(239,68,68,0.85); color: #fff; }
.gallery-approval-badge.pending { background: rgba(255,214,10,0.85); color: #0a0a0b; }
.gallery-approval-actions { display: flex; gap: 6px; padding: 6px 12px 10px; }
.gallery-approve-btn { flex: 1; background: rgba(57,255,20,0.12); border: 1px solid rgba(57,255,20,0.3); border-radius: 6px; padding: 5px 0; font-size: 0.65rem; font-weight: 700; color: var(--nox); cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; text-transform: uppercase; }
.gallery-approve-btn:hover { background: rgba(57,255,20,0.25); }
.gallery-reject-btn { flex: 1; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-radius: 6px; padding: 5px 0; font-size: 0.65rem; font-weight: 700; color: #ef4444; cursor: pointer; transition: all 0.15s; letter-spacing: 0.05em; text-transform: uppercase; }
.gallery-reject-btn:hover { background: rgba(239,68,68,0.2); }
.gallery-approve-btn.active { background: var(--nox); color: #0a0a0b; }
.gallery-reject-btn.active { background: #ef4444; color: #fff; }

/* Approval summary bar */
.approval-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; align-items: center; }
.approval-stat { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
.approval-stat-dot { width: 8px; height: 8px; border-radius: 50%; }
.approval-stat-dot.approved { background: var(--nox); }
.approval-stat-dot.rejected { background: #ef4444; }
.approval-stat-dot.pending { background: var(--patch); }
.approval-stat-num { font-weight: 800; font-family: 'Geist Mono', ui-monospace, monospace; }
.approval-filter-btn { margin-left: auto; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 0.72rem; color: var(--dim); cursor: pointer; transition: all 0.15s; }
.approval-filter-btn:hover { color: var(--text); }
.approval-filter-btn.active { color: var(--text); border-color: var(--glim); background: var(--surface); }

/* Modal approval */
.gallery-modal-approval { display: flex; gap: 10px; margin-top: 16px; }
.gallery-modal-approval button { flex: 1; padding: 10px; border-radius: 8px; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.15s; border: 1px solid; }
.gallery-modal-approval .modal-approve { background: rgba(57,255,20,0.15); border-color: rgba(57,255,20,0.4); color: var(--nox); }
.gallery-modal-approval .modal-approve:hover { background: rgba(57,255,20,0.3); }
.gallery-modal-approval .modal-approve.active { background: var(--nox); color: #0a0a0b; }
.gallery-modal-approval .modal-reject { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.4); color: #ef4444; }
.gallery-modal-approval .modal-reject:hover { background: rgba(239,68,68,0.25); }
.gallery-modal-approval .modal-reject.active { background: #ef4444; color: #fff; }


/* Story section */
.story-section { border-top: 1px solid var(--border); }
.story-tagline { font-size: 1.1rem; color: var(--dim); margin-bottom: 24px; text-align: center; }
.story-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; justify-content: center; }
.story-nav-link { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 16px; color: var(--dim); text-decoration: none; font-size: 0.8rem; font-weight: 600; transition: all 0.15s; }
.story-nav-link:hover { color: var(--text); border-color: var(--vex); }
.story-content { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; font-size: 0.95rem; line-height: 1.8; }
.story-chapter { margin-bottom: 40px; }
.story-chapter:last-child { margin-bottom: 0; }
.story-chapter h1 { font-size: 1.6rem; font-weight: 800; color: var(--vex); margin: 32px 0 16px; letter-spacing: 0.02em; }
.story-chapter h2 { font-size: 1.2rem; font-weight: 700; color: var(--glim); margin: 28px 0 12px; }
.story-chapter h3 { font-size: 1.05rem; font-weight: 600; color: var(--patch); margin: 24px 0 10px; }
.story-chapter p { margin: 12px 0; color: var(--text); }
.story-chapter blockquote { border-left: 3px solid var(--vex); padding: 8px 16px; margin: 16px 0; color: var(--dim); font-style: italic; background: rgba(255,45,149,0.05); border-radius: 0 8px 8px 0; }
.story-chapter strong { color: var(--text); }
.story-chapter em { color: var(--dim); }
.story-chapter hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.story-chapter ul, .story-chapter ol { margin: 12px 0 12px 24px; }
.story-chapter li { margin: 6px 0; }
.story-table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.85rem; }
.story-table th, .story-table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.story-table th { background: var(--surface2); color: var(--dim); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.story-table td { color: var(--text); }

/* Character Arcs section */
.arcs-section { border-top: 1px solid var(--border); }
.arcs-intro { text-align: center; color: var(--dim); font-size: 0.9rem; max-width: 600px; margin: 0 auto 24px; }
.arcs-nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 32px; }
.arc-nav-btn { background: var(--surface); border: 1px solid; border-radius: 8px; padding: 6px 16px; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s; text-decoration: none; }
.arc-nav-btn:hover { transform: translateY(-1px); opacity: 0.85; }
.arcs-grid { display: flex; flex-direction: column; gap: 16px; }
.arc-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: border-color 0.15s; }
.arc-card:hover { border-color: #333; }
.arc-card-header { padding: 16px 20px; cursor: pointer; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; transition: background 0.15s; }
.arc-card-header:hover { background: var(--surface2); }
.arc-card-title { display: flex; align-items: center; gap: 10px; flex: 1; }
.arc-card-emoji { font-size: 1.4rem; }
.arc-card-name { font-size: 1.1rem; font-weight: 800; letter-spacing: 0.05em; }
.arc-card-role { font-size: 0.8rem; color: var(--dim); }
.arc-card-sig { font-size: 0.8rem; color: var(--dim); font-style: italic; }
.arc-card-toggle { font-size: 0.8rem; color: var(--dim); transition: transform 0.2s; }
.arc-card-toggle.open { transform: rotate(180deg); }
.arc-card-body { padding: 0 24px 24px; font-size: 0.9rem; line-height: 1.7; border-top: 1px solid var(--border); }
.arc-card-body p { margin: 10px 0; }
.arc-card-body h1 { font-size: 1.2rem; font-weight: 700; margin: 20px 0 10px; }
.arc-card-body h2 { font-size: 1.05rem; font-weight: 700; margin: 18px 0 8px; color: var(--text); }
.arc-card-body h3 { font-size: 0.95rem; font-weight: 600; margin: 16px 0 6px; color: var(--dim); }
.arc-card-body blockquote { border-left: 3px solid var(--glim); padding: 6px 14px; margin: 12px 0; color: var(--dim); font-style: italic; background: rgba(0,229,255,0.04); border-radius: 0 8px 8px 0; }
.arc-card-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.8rem; }
.arc-card-body th, .arc-card-body td { padding: 6px 10px; border: 1px solid var(--border); }
.arc-card-body th { background: var(--surface2); color: var(--dim); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.arc-card-body hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.arc-card-body ul { margin: 8px 0 8px 20px; }
.arc-card-body li { margin: 4px 0; }
.arc-card-body strong { color: var(--text); }
.arc-identity { margin-bottom: 16px; }
.arc-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.arc-section-title { font-size: 1rem; font-weight: 700; margin: 20px 0 12px; letter-spacing: 0.02em; }


/* Brand Videos — custom controls */
.brand-video-section { margin-top: 48px; }
.brand-video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 20px; }
.brand-video-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s; }
.brand-video-card:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(255,45,149,0.12); }
.brand-video-wrap { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; cursor: pointer; overflow: hidden; }
.brand-video-wrap video { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand-play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.3); opacity: 1; transition: opacity 0.25s; pointer-events: none; }
.brand-play-overlay.hidden { opacity: 0; }
.brand-play-overlay svg { width: 48px; height: 48px; fill: #FFD700; filter: drop-shadow(0 2px 12px rgba(255,215,0,0.5)); }
.brand-controls { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #111118; border-top: 1px solid #222; }
.brand-ctrl-btn { background: none; border: none; color: #ccc; cursor: pointer; padding: 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: background 0.15s, color 0.15s; flex-shrink: 0; }
.brand-ctrl-btn:hover { background: rgba(255,255,255,0.08); color: #FFD700; }
.brand-ctrl-btn svg { width: 18px; height: 18px; fill: currentColor; }
.brand-progress-wrap { flex: 1; height: 6px; background: #2a2a3a; border-radius: 3px; cursor: pointer; position: relative; }
.brand-progress-fill { height: 100%; background: linear-gradient(90deg, #FFD700, #FF6B9D); border-radius: 3px; width: 0%; }
.brand-progress-wrap:hover .brand-progress-fill { height: 8px; margin-top: -1px; }
.brand-time { font-size: 0.7rem; color: #888; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 70px; text-align: center; }
.brand-video-info { padding: 14px 16px; }
.brand-video-info h3 { font-size: 1rem; color: #FFD700; margin-bottom: 4px; }
.brand-video-info .brand-tag { display: inline-block; font-size: 0.65rem; padding: 2px 7px; border-radius: 4px; background: #1e1e30; color: #777; font-family: monospace; margin-bottom: 4px; }
.brand-video-info p { font-size: 0.8rem; color: #999; line-height: 1.4; }

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
  .nav { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .nav-brand span { font-size: 0.85rem; }
  .nav-links { gap: 10px; width: 100%; justify-content: center; }
  .nav-links a { font-size: 0.7rem; padding: 4px 8px; }
  .section { padding: 28px 14px; }
  .section-title { font-size: 1.3rem; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .gallery-cat-tabs { gap: 4px; }
  .gallery-tab { padding: 5px 10px; font-size: 0.7rem; }
  .gallery-sub-tab { padding: 3px 8px; font-size: 0.65rem; }
  .gallery-card-prompt { font-size: 0.6rem; }
  .gallery-card-meta { font-size: 0.55rem; }
  .gallery-modal { padding: 16px; }
  .gallery-modal-content model-viewer { height: 300px; }
  .gen-panel { padding: 16px; }
  .gen-prompt { min-height: 80px; font-size: 0.85rem; padding: 12px; }
  .gen-dna-row { gap: 5px; }
  .gen-dna-btn { padding: 5px 10px; font-size: 0.65rem; }
  .gen-btn { padding: 10px 20px; font-size: 0.8rem; }
  .gen-row { flex-direction: column; gap: 8px; }
  .gen-server-input { min-width: 100%; }
  .gen3d-panel { padding: 16px; }
  .gen3d-prompt { min-height: 70px; }
  .api-grid { grid-template-columns: 1fr; }
  .dep-table { font-size: 0.75rem; }
  .dep-table td, .dep-table th { padding: 6px 8px; }
  .file-tree { font-size: 0.7rem; padding: 12px; }
  .story-content { padding: 16px; font-size: 0.85rem; }
  .story-chapter h1 { font-size: 1.2rem; }
  .story-chapter h2 { font-size: 1rem; }
  .story-nav-link { padding: 4px 10px; font-size: 0.7rem; }
  .approval-summary { padding: 10px 12px; flex-direction: column; gap: 8px; }
  .approval-filter-btn { margin-left: 0; }
  .gallery-approval-actions { padding: 4px 8px 8px; }
  .gallery-approve-btn, .gallery-reject-btn { font-size: 0.55rem; padding: 4px 0; }
  .gen-history-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .gen3d-history-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .brand-video-card { margin-bottom: 16px; }
  .footer { padding: 20px 14px; font-size: 0.65rem; }
  .gate-input { width: 240px; font-size: 0.8rem; }
  .gate h1 { font-size: 1.2rem; }
  .gate-logo { width: 48px; height: 48px; }
  .checklist li { font-size: 0.78rem; }
  .arcs-nav { gap: 5px; }
  .arc-nav-btn { padding: 4px 10px; font-size: 0.7rem; }
  table.story-table { font-size: 0.75rem; }
  table.story-table th, table.story-table td { padding: 5px 8px; }
}
@media (max-width: 480px) {
  .nav-links { gap: 6px; }
  .nav-links a { font-size: 0.6rem; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .section { padding: 20px 10px; }
  .section-title { font-size: 1.1rem; }
  .gen-dna-btn { padding: 4px 8px; font-size: 0.6rem; }
  .gallery-card-info { padding: 6px 8px; }
}
</style>
<style>
/* VIDEO LIBRARY */
.video-lib { border-top: 1px solid var(--border); }
.video-cat { margin-bottom: 32px; }
.video-cat-title { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; transition: all 0.2s; }
.video-card:hover { border-color: var(--glim); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.video-card video { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; background: #000; }
.video-card video.portrait { aspect-ratio: 9/16; }
.video-card-info { padding: 10px 12px; }
.video-card-name { font-size: 0.8rem; font-weight: 700; margin-bottom: 2px; }
.video-card-meta { font-size: 0.65rem; color: var(--dim); font-family: "Geist Mono", ui-monospace, monospace; display: flex; justify-content: space-between; }
.video-card-tag { display: inline-block; font-size: 0.55rem; padding: 2px 6px; border-radius: 4px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; margin-right: 4px; }
.tag-logo { background: rgba(255,45,149,0.15); color: var(--vex); }
.tag-hero { background: rgba(0,229,255,0.15); color: var(--glim); }
.tag-teaser { background: rgba(255,214,10,0.15); color: var(--patch); }
.tag-remake { background: rgba(168,85,247,0.15); color: var(--rook); }
.tag-crew { background: rgba(57,255,20,0.15); color: var(--nox); }
/* Video fallback for missing files */
.video-card video.error { display: none; }
.video-card .video-fallback {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--dim);
  font-size: 0.75rem;
  border: 1px dashed var(--border);
}
.video-card .video-fallback .vf-icon { font-size: 2rem; opacity: 0.5; }
.video-card .video-fallback.portrait { aspect-ratio: 9/16; }
