:root {
  /* LibTV 風格：中性炭黑、白色主按鈕、低彩度 */
  --bg: #121212; --panel: #1b1b1b; --panel-2: #242424; --line: #2a2a2a; --line-2: #363636;
  --text: #ededed; --muted: #8f8f8f; --faint: #5e5e5e;
  --accent: #f2f2f2; --accent-ink: #111111; --accent-dim: rgba(255, 255, 255, .08);
  --warn: #e0b36a; --bad: #f07a7a; --ok: #d9d9d9; --info: #9ab4d6;
  --img: #9ab4d6; --vid: #b9a6d6; --aud: #d6bf96;
  --r: 14px; --r-sm: 10px;
  --font: 'Noto Sans TC', system-ui, -apple-system, 'PingFang TC', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
a.btn { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s; user-select: none; }
.btn:hover { border-color: #555; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.primary:hover { background: #ffffff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.icon-btn { width: 30px; height: 30px; padding: 0; }

input[type=text], input[type=password], input[type=number], input:not([type]), select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 8px 10px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.6; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.wordmark { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .02em; font-size: 15px; }
.wordmark .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }

/* topbar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 18px;
  background: rgba(14, 15, 18, .9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; flex: 1; }
.tabs button { background: none; border: 0; padding: 8px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; font-weight: 500; }
.tabs button.on { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.me { display: flex; align-items: center; gap: 10px; }
.quota { font-size: 12px; color: var(--muted); }
body:not(.is-admin) .admin-only { display: none !important; }

.tab { min-height: calc(100vh - 56px); }

/* studio */
.studio { display: grid; grid-template-columns: minmax(340px, 430px) 1fr; }
.composer { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; border-right: 1px solid var(--line);
  padding: 18px 18px 0; display: grid; gap: 18px; align-content: start; }
.field { display: grid; gap: 8px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 500; }
.field-head .hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 34px; min-width: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.on .new { background: var(--accent-ink); color: var(--accent); }
.chip .sub { font: 11px var(--mono); color: var(--faint); }
.chip.on .sub { color: inherit; opacity: .7; }
.chip .new { font: 600 9px var(--mono); background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 1px 4px; }
.chip.model { height: auto; min-height: 36px; padding: 6px 12px; text-align: left; }
.chips.num .chip { font-family: var(--mono); }
.toggle-row { display: flex; flex-wrap: wrap; gap: 14px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--muted); }
.toggle input { accent-color: var(--accent); width: 16px; height: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.refs { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.refs.drop { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 8px; }
.ref { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line-2); }
.ref img, .ref video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref .audio-face { display: grid; place-items: center; height: 100%; color: var(--aud); font: 600 12px var(--mono); }
.ref .tag { position: absolute; left: 4px; top: 4px; font: 600 10px var(--mono); padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.72); }
.ref .tag.image { color: var(--img); } .ref .tag.video { color: var(--vid); } .ref .tag.audio { color: var(--aud); }
.ref .x { position: absolute; right: 3px; top: 3px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: rgba(0,0,0,.72); cursor: pointer; line-height: 1; }
.ref .role { position: absolute; left: 3px; right: 3px; bottom: 3px; font-size: 11px; padding: 2px 4px; height: 22px; background: rgba(0,0,0,.78); border: 0; border-radius: 5px; }
.ref .move { position: absolute; right: 3px; bottom: 29px; display: flex; gap: 2px; }
.ref .move button { width: 20px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: rgba(0,0,0,.72); cursor: pointer; font-size: 11px; }
.ref.uploading { display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.ref-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.insert-row { display: flex; flex-wrap: wrap; gap: 4px; }
.insert-row button { font: 600 11px var(--mono); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; color: var(--muted); }
.insert-row button:hover { color: var(--text); border-color: var(--muted); }

.submit-bar { position: sticky; bottom: 0; margin: 0 -18px; padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg); border-top: 1px solid var(--line); display: grid; gap: 8px; z-index: 5; }
.submit-bar .est { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.submit-bar .btn.primary { height: 46px; font-size: 15px; }
.batch { display: flex; align-items: center; gap: 6px; }
.batch .chip { height: 28px; min-width: 34px; }

/* gallery */
.gallery { padding: 18px; min-width: 0; }
.gallery-head, .lib-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.lib-head { padding: 18px 18px 0; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.job { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 1px 0 rgba(255,255,255,.03) inset; overflow: hidden; display: flex; flex-direction: column; }
.job .media { position: relative; aspect-ratio: 16/9; background: #000; display: grid; place-items: center; }
.job .media video, .job .media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.job .media .state { text-align: center; color: var(--muted); font-size: 13px; display: grid; gap: 6px; justify-items: center; padding: 10px; }
.job .media .state.bad { color: var(--bad); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.job .body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.job .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font: 12px var(--mono); color: var(--muted); }
.badge { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--panel-2); color: var(--muted); }
.badge.queued, .badge.running, .badge.submitting, .badge.saving { color: var(--info); }
.badge.succeeded { color: var(--ok); }
.badge.failed, .badge.expired { color: var(--bad); }
.badge.cancelled { color: var(--faint); }
.job .prompt { font-size: 13px; color: #c5c8cf; white-space: pre-wrap; word-break: break-word; max-height: 4.8em; overflow: hidden; cursor: pointer; }
.job .prompt.open { max-height: none; }
.job .err { font-size: 12px; color: var(--bad); word-break: break-word; }
.job .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.job .who { margin-left: auto; color: var(--faint); }
.star.on { color: var(--warn); border-color: var(--warn); }
.more { display: flex; justify-content: center; padding: 18px; }
.empty { color: var(--muted); padding: 40px 10px; text-align: center; grid-column: 1 / -1; }

/* library */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; padding: 18px; }
.asset { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; cursor: default; }
.asset.pick { cursor: pointer; }
.asset.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.asset .thumb { aspect-ratio: 1; background: #000; position: relative; }
.asset .thumb img, .asset .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset .thumb .audio-face { display: grid; place-items: center; height: 100%; color: var(--aud); font: 600 13px var(--mono); }
.asset .thumb .tag { position: absolute; left: 6px; top: 6px; font: 600 10px var(--mono); padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.72); }
.asset .info { padding: 8px; display: grid; gap: 6px; }
.asset .name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset .row { display: flex; gap: 4px; }

/* admin */
.admin { padding: 18px; display: grid; gap: 16px; align-content: start; max-width: 1200px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-family: var(--mono); }
.form-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; align-items: end; }
.form-inline label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); align-content: start; }
.model-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.model-row .id { font: 12px var(--mono); color: var(--muted); }
.model-row.off { opacity: .55; }
.switch { position: relative; width: 38px; height: 22px; display: inline-block; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--line-2); cursor: pointer; transition: .15s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 10px; }
.cfg-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); align-content: start; }
.cfg-grid label.toggle { display: flex; align-self: center; font-size: 13px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 90px 1fr 80px; gap: 10px; align-items: center; font: 12px var(--mono); }
.bar .track { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar .fill { height: 100%; background: #cfcfcf; border-radius: 5px; }

/* modal & toast */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.modal-card { width: min(820px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; padding: 18px; display: grid; gap: 14px; }
.modal-card.narrow { width: min(420px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }
.modal .asset-grid { padding: 0; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.toasts { position: fixed; z-index: 200; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { background: #262626; border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 9px; font-size: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.4); animation: up .18s ease-out; }
.toast.bad { border-left-color: var(--bad); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* canvas */
.canvas-tab { position: relative; height: calc(100vh - 56px); overflow: hidden; }
.cv-toolbar { position: absolute; z-index: 5; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
.cv-toolbar > * { pointer-events: auto; }
.cv-toolbar .group { display: flex; gap: 4px; background: rgba(22, 24, 29, .92); border: 1px solid var(--line); border-radius: 10px; padding: 4px; align-items: center; backdrop-filter: blur(8px); }
.cv-toolbar select { width: auto; max-width: 180px; height: 30px; padding: 0 8px; }
.cv-toolbar .saved { font-size: 11px; color: var(--faint); padding: 0 6px; }
.cv-stage { position: absolute; inset: 0; touch-action: none; cursor: grab;
  background-image: none; background-color: #161616; }
.cv-stage.panning { cursor: grabbing; }
.cv-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.cv-edges path { fill: none; stroke: rgba(91, 156, 255, .55); stroke-width: 1.6; }
.cv-edges path.hit { stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.cv-edges path.sel { stroke: #fff; stroke-width: 2.4; }
.cv-edges path.hot { stroke: #6aa8ff; stroke-width: 2; }
.cv-edges path.temp { stroke: #6aa8ff; stroke-dasharray: 6 5; }
.cv-edges text { font: 600 11px var(--mono); fill: var(--accent); paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.cv-hint { position: absolute; left: 12px; bottom: 12px; font-size: 12px; color: var(--faint); pointer-events: none; }
.cv-menu { position: absolute; z-index: 10; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 4px; display: grid; min-width: 150px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.cv-menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.cv-menu button:hover { background: var(--panel); }
.cv-menu button.danger { color: var(--bad); }
.cv-box { position: absolute; z-index: 6; border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.06); border-radius: 4px; pointer-events: none; }
.cv-stage.dropping { outline: 2px dashed rgba(255,255,255,.35); outline-offset: -10px; }
.cv-stage.dropping::after { content: '放開以加入素材'; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.node.drop-hot { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,255,255,.25), 0 10px 30px rgba(0,0,0,.35); }

/* 素材審核與多人像授權確認 */
.ref-review { position: absolute; left: 4px; top: 28px; padding: 3px 6px; border: 1px solid #777; border-radius: 5px; background: rgba(0,0,0,.8); font-size: 10px; cursor: pointer; }
.review-photo { width: 100%; max-height: 220px; object-fit: contain; border-radius: 8px; background: #101010; }
.review-progress { font-size: 13px; margin-top: 12px; color: var(--muted); }
.material-review-control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.material-review-button { flex: none; white-space: nowrap; border-color: #8ba9e8; color: #dce8ff; background: #233453; min-height: 30px; padding: 5px 9px; cursor: pointer; }
.material-review-state { color: var(--muted); font-size: 11px; line-height: 1.4; }
.material-review-control.ready .material-review-state { color: #8de0b1; }
.cv-asset-visual, .cv-generated-visual { position: relative; min-width: 0; }
.cv-asset-review { position: absolute; top: 8px; right: 8px; z-index: 5; display: block; }
.cv-asset-review .material-review-control { flex-direction: column; align-items: flex-end; gap: 4px; }
.cv-asset-review .material-review-button { display: inline-flex; align-items: center; visibility: visible; opacity: 1; min-height: 30px; border: 1px solid #a7c4ff; background: #203659; color: #fff; box-shadow: 0 2px 10px #0009; }
.cv-asset-review .material-review-state { padding: 3px 5px; border-radius: 4px; background: #101722e8; color: #eee; font-size: 10px; }
.cv-asset-review .material-review-complete, .material-review-complete { display: inline-grid; place-items: center; width: 26px; height: 26px; min-height: 26px; padding: 0; border-radius: 50%; background: #197846; color: #fff; border: 1px solid #8ce0a9; font-size: 18px; line-height: 1; }
.material-review-state[hidden] { display: none !important; }
.ref-depth { position: absolute; top: 28px; left: 4px; right: 4px; padding: 4px 2px; border: 1px solid #8097bf; border-radius: 5px; background: #1d2d45e8; color: #e5edff; font-size: 10px; cursor: pointer; }
.cv-reference-reviews { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cv-reference-review { display: flex; align-items: center; gap: 6px; }
.review-steps { padding-left: 24px; display: grid; gap: 8px; font-size: 13px; color: var(--muted); }
.review-steps .done { color: #8de0b1; }
.ref .material-review-control { position: absolute; top: 28px; left: 4px; right: 4px; flex-direction: column; align-items: flex-start; gap: 2px; }
.ref .material-review-state { padding: 1px 3px; background: rgba(0,0,0,.82); border-radius: 3px; font-size: 9px; }
.review-pick { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.review-pick button { height: auto; padding: 8px; white-space: normal; flex-direction: column; }
.review-pick img { width: 100%; height: 110px; object-fit: contain; }
.error-details { min-width: 0; color: var(--muted); font-size: 11px; }
.error-details summary { cursor: pointer; }
.error-details pre { max-height: 180px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); }
.cv-stage.select-mode { cursor: crosshair; }
.cv-stage.space-pan, .cv-stage.panning { cursor: grab; }
.cv-stage.dragging-node, .cv-stage.dragging-node .node { cursor: grabbing; }
.node .preview img, .node .preview:not(:has(video,audio)), .node .nb { cursor: grab; }
.node .nb input, .node .nb select, .node .nb textarea { cursor: auto; }
.cv-world, .cv-world img { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.cv-world textarea, .cv-world input { user-select: text; -webkit-user-select: text; }
.cv-selection { font-size: 11px; color: var(--muted); padding: 0 4px; white-space: nowrap; }
.cv-toolbar { flex-wrap: wrap; max-width: calc(100% - 24px); }
.cv-toolbar .btn.on { background: var(--accent); color: var(--accent-ink); }

/* 畫布：大預覽、提示詞與底部參數列 */
.node.generate { width: 460px; border-radius: 16px; background: #171717; }
.node.generate > .nb { padding: 8px; gap: 10px; }
.node.generate > .nb > .preview { width: 100%; aspect-ratio: 16/9; border-radius: 10px; background: #0c0c0c; }
.node.generate .nh { padding: 9px 12px; border-bottom: 0; }
.cv-editor { background: #202020; border: 1px solid #363636; border-radius: 13px; padding: 12px; display: grid; gap: 10px; }
.cv-editor-head { display: flex; align-items: center; justify-content: space-between; }
.cv-ref-strip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.cv-ref-thumb { position: relative; flex: 0 0 48px; height: 48px; border: 1px solid #4b4b4b; border-radius: 7px; background: #111; overflow: hidden; display: grid; place-items: center; }
.cv-ref-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cv-ref-number { position: absolute; left: 2px; bottom: 1px; padding: 0 3px; border-radius: 3px; background: rgba(0,0,0,.8); color: white; font: 9px var(--mono); }
.cv-ref-empty { padding: 10px; border: 1px dashed #464646; border-radius: 7px; }
.node.generate .cv-editor textarea { background: transparent; padding: 0; min-height: 94px; border: 0; border-radius: 0; font-size: 13px; resize: vertical; }
.cv-linked-prompt { min-height: 80px; max-height: 180px; overflow: auto; white-space: pre-wrap; font-size: 13px; cursor: text; user-select: text; }
.cv-ref-settings { color: var(--muted); font-size: 11px; }
.cv-ref-settings summary { cursor: pointer; margin-bottom: 7px; }
.cv-param-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border-top: 1px solid #343434; padding-top: 10px; }
.node.generate .cv-param-bar select { width: auto; max-width: 120px; background: #292929; border-color: #414141; font-size: 11px; height: 28px; border-radius: 7px; }
.node.generate .cv-param-bar select[aria-label="生成模型"] { max-width: 180px; flex: 1; }
.cv-param-fixed { font-size: 11px; padding: 4px 7px; border: 1px solid #414141; border-radius: 7px; }
.cv-extra-options { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.cv-extra-options > span { margin-left: auto; }
.cv-run-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 3px; }
.cv-run-actions { display: flex; gap: 7px; }
.a-settings { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.a-settings > label { display: grid; grid-template-columns: 60px 1fr; align-items: center; gap: 8px; }
.a-settings select { font-size: 12px; height: 31px; padding: 3px 8px; }
.a-knowledge { max-height: 220px; overflow-y: auto; font-size: 12px; }
.a-knowledge summary { cursor: pointer; }
.a-skill-row { display: flex; gap: 6px; align-items: center; margin: 8px 0; }
.a-skill-row label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.node.asset { border-radius: 13px; overflow: visible; }
.node.asset .preview { aspect-ratio: 4/3; }
.node.asset .nb { padding: 7px; }
.node.asset .nh { border-bottom: 0; font-size: 12px; }

/* mobile */
@media (max-width: 860px) {
  .topbar { padding: 0 10px; gap: 8px; height: 52px; }
  .topbar .wordmark span:last-child { display: none; }
  .tabs button { padding: 7px 9px; font-size: 13px; }
  .quota { display: none; }
  .tab { min-height: calc(100vh - 52px); }
  .studio { grid-template-columns: 1fr; }
  .composer { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); padding: 14px 14px 0; }
  .submit-bar { margin: 0 -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); z-index: 20; }
  .gallery { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .chip { height: 40px; min-width: 48px; }
  .refs { grid-template-columns: repeat(3, 1fr); }
  .asset-grid { grid-template-columns: repeat(2, 1fr); padding: 14px; }
  .lib-head { padding: 14px 14px 0; }
  .admin { padding: 14px; }
  .canvas-tab { height: calc(100vh - 52px); }
  .model-row { grid-template-columns: auto 1fr; }
  .model-row > :last-child { grid-column: 1 / -1; }
}

/* 秒數拖桿 */
.dur { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.dur-val { font-size: 15px; font-weight: 600; min-width: 42px; text-align: right; }
.dur-scale { grid-column: 1 / -1; display: flex; justify-content: space-between; color: var(--faint); }
.dur-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; padding: 0; border: 0; margin: 0; cursor: pointer; }
.dur-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line-2) var(--p, 0%)); }
.dur-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line-2); }
.dur-range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.dur-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.dur-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; }
.dur.compact .dur-val { font-size: 13px; }
.dur.compact .dur-range { height: 22px; }
/* 模型素材上限 */
.limits { font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.limits.over { border-color: var(--bad); }
.limits .over { color: var(--bad); }
.err { color: var(--bad); }
@media (max-width: 860px) { .dur-range { height: 36px; } .dur-range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; } }

select.variant { font-family: var(--mono); font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stats .big { font-size: 26px; font-weight: 600; margin: 2px 0; }
#adminBody { display: grid; gap: 16px; }

/* 導演助手 */
.agent { position: fixed; z-index: 60; top: 56px; right: 0; bottom: 0; width: min(440px, 100vw); background: var(--panel); border-left: 1px solid var(--line-2);
  display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.4); }
.a-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.a-ctx { padding: 6px 14px; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.a-msg { display: grid; gap: 8px; }
.a-msg.user { align-self: flex-end; max-width: 88%; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px 12px 4px 12px; padding: 8px 12px; }
.a-msg.assistant { align-self: stretch; }
.a-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.65; }
.a-prompt { background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.a-prompt pre { margin: 0; padding: 12px; white-space: pre-wrap; word-break: break-word; font: 13px/1.7 var(--font); max-height: 360px; overflow: auto; }
.a-actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--panel); }
.a-empty { color: var(--text); display: grid; gap: 8px; padding: 8px 2px; }
.a-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.a-busy { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; }
.a-input { border-top: 1px solid var(--line); padding: 10px; display: grid; gap: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.a-input .btn { justify-self: end; }
@media (min-width: 1100px) { body.agent-open #tab-studio .gallery { margin-right: 440px; } }
@media (max-width: 860px) { .agent { top: 52px; } }
/* 素材規格 */
.ref.bad { outline: 2px solid var(--bad); outline-offset: -2px; }
.spec-list { display: grid; gap: 10px; font-size: 13px; }
.spec-list ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }

.draft-toggle { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); cursor: pointer; background: var(--panel); }
.draft-toggle.on { border-color: var(--accent); }
.draft-toggle input { accent-color: var(--accent); width: 16px; height: 16px; margin-top: 2px; }
.badge.draft { color: #f0d08a; } .badge.final { color: var(--text); background: #333; }

/* ===== 畫布（LibTV 式） ===== */
.canvas-tab { background: #161616; }
.cv-stage { background-color: #161616; background-image: none; }
.node { position: absolute; width: 210px; background: transparent; border: 0; box-shadow: none; cursor: grab; user-select: none; }
.node .cap { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #9a9a9a; padding: 0 2px 5px; white-space: nowrap; }
.node .cap .ico { font-size: 10px; color: #bbb; }
.node .cap .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.node .cap .dims { margin-left: auto; font: 10px var(--mono); color: #6f6f6f; flex: none; }
.node .media { display: block; width: 100%; border-radius: 8px; background: #0b0b0b; border: 1px solid #2c2c2c; overflow: hidden; }
.node img.media, .node video.media { height: auto; max-height: 340px; object-fit: contain; }
.node .media.empty { aspect-ratio: 4/3; display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: 12px; }
.node .media.text textarea { border: 0; min-height: 120px; font-size: 12px; background: transparent; }
.node.sel .media { border-color: #fff; box-shadow: 0 0 0 1px #fff; }
.node.drop-hot .media { border-color: #6aa8ff; box-shadow: 0 0 0 3px rgba(106,168,255,.35); }
.node.generate { width: 320px; }
.node.generate .media.vid { position: relative; display: grid; place-items: center; }
.node.generate .media.vid video { width: 100%; height: 100%; object-fit: contain; display: block; }
.gen-state { display: grid; gap: 6px; justify-items: center; text-align: center; color: var(--muted); font-size: 12px; padding: 10px; }
.gen-state.bad { color: var(--bad); }
.play-ico { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #333; display: grid; place-items: center; color: #555; font-size: 14px; }
.tag-draft, .tag-final { font: 600 10px var(--mono); padding: 1px 5px; border-radius: 4px; }
.tag-draft { color: #f0d08a; background: rgba(240,208,138,.12); } .tag-final { color: #fff; background: #333; }
.pager { display: inline-flex; align-items: center; gap: 2px; font: 10px var(--mono); color: #aaa; }
.pager button { background: #262626; border: 0; color: #ddd; width: 16px; height: 16px; border-radius: 4px; cursor: pointer; padding: 0; line-height: 1; }
.port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: #161616; border: 2px solid #6aa8ff; opacity: 0; transition: opacity .12s; cursor: crosshair; touch-action: none; }
.node:hover .port, .node.sel .port, .node.drop-hot .port { opacity: 1; }
.port.out { right: -8px; top: calc(50% + 4px); } .port.in { left: -8px; top: calc(50% + 4px); cursor: default; }
.cv-empty { position: absolute; inset: 35% 0 auto; text-align: center; pointer-events: none; display: grid; gap: 6px; }
.cv-empty .big { font-size: 16px; color: #8a8a8a; }
.menu-item { display: block; text-align: left; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.menu-item:hover { background: var(--panel); }

/* 節點上方工具列 */
.cv-ntool { position: absolute; z-index: 8; display: flex; gap: 2px; padding: 5px; background: rgba(28,28,28,.96); border: 1px solid #333; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.45); white-space: nowrap; }
.cv-ntool button { background: none; border: 0; color: #ddd; padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.cv-ntool button:hover { background: #2a2a2a; }
.cv-ntool button.primary { background: #fff; color: #111; font-weight: 600; }
.cv-ntool button.danger { color: var(--bad); }

/* 左下工具 */
.cv-dock { position: absolute; z-index: 7; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 2px; padding: 5px; background: rgba(28,28,28,.96); border: 1px solid #333; border-radius: 14px; }
.dock-btn { width: 36px; height: 36px; border-radius: 10px; border: 0; background: none; color: #ccc; cursor: pointer; display: grid; place-items: center; font-size: 16px; }
.dock-btn:hover { background: #2a2a2a; }
.dock-btn.primary { background: #fff; color: #111; font-size: 20px; }
.dock-sep { width: 1px; height: 22px; background: #333; margin: 0 4px; }
.zoom-val { font-size: 11px; color: #888; min-width: 38px; text-align: center; }

/* 底部輸入框 */
.cv-composer { position: absolute; z-index: 9; left: 50%; transform: translateX(-50%); bottom: 18px; width: min(1000px, calc(100% - 32px));
  background: #232323; border: 1px solid #333; border-radius: 22px; padding: 12px 14px 12px; box-shadow: 0 16px 50px rgba(0,0,0,.55); display: grid; gap: 10px; }
.cv-composer.drop { border-color: #6aa8ff; }
.cc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cc-chip { height: 32px; padding: 0 12px; border-radius: 9px; background: #2c2c2c; border: 0; color: #aaa; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.cc-chip:hover { color: #fff; background: #333; }
.cc-icon { width: 30px; height: 30px; border: 0; background: none; color: #999; cursor: pointer; font-size: 16px; border-radius: 8px; }
.cc-icon:hover { background: #2c2c2c; color: #fff; }
.cc-grow { flex: 1; }
.cc-refs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.cc-thumb { position: relative; flex: none; width: 70px; height: 70px; border-radius: 10px; overflow: hidden; background: #111; border: 1px solid #3a3a3a; cursor: pointer; }
.cc-thumb img, .cc-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.cc-thumb .ph { display: grid; place-items: center; height: 100%; font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.cc-thumb .num { position: absolute; left: 4px; top: 4px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.75); color: #fff; font: 600 11px/18px var(--mono); text-align: center; }
.cc-thumb .role { position: absolute; left: 4px; bottom: 4px; font-size: 10px; padding: 1px 5px; border-radius: 4px; background: #fff; color: #111; font-weight: 600; }
.cc-thumb .acts { position: absolute; right: 2px; top: 2px; display: none; gap: 2px; }
.cc-thumb:hover .acts { display: flex; }
.cc-thumb .acts button { width: 18px; height: 18px; border: 0; border-radius: 5px; background: rgba(0,0,0,.8); color: #fff; cursor: pointer; padding: 0; font-size: 11px; line-height: 1; }
.cc-thumb.unused { opacity: .35; }
.cc-thumb.bad { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.cc-prompt { background: transparent; border: 0; padding: 4px 2px; font-size: 15px; line-height: 1.75; resize: none; color: #e8e8e8; }
.cc-prompt:focus { border: 0; outline: none; }
.cc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cc-sel { height: 40px; padding: 0 12px; border-radius: 11px; background: #2c2c2c; border: 0; color: #e6e6e6; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.cc-sel:hover { background: #333; }
.cc-sel .car { color: #888; font-size: 12px; }
.mi { width: 22px; height: 22px; border-radius: 7px; background: #3a3a3a; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.mi.sm { background: none; border: 1px solid #555; color: #ccc; font-size: 11px; }
.cc-div { width: 1px; height: 24px; background: #3a3a3a; }
.ratio-ico { display: inline-block; border: 1.6px solid #ccc; border-radius: 3px; }
.cc-cost { color: #9a9a9a; font-size: 14px; }
.cc-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #111; font-size: 20px; font-weight: 700; cursor: pointer; }
.cc-send:hover { background: #e8e8e8; }
.cc-send.busy { opacity: .5; cursor: wait; }
.cc-pop { position: absolute; bottom: calc(100% + 10px); z-index: 12; background: #262626; border: 1px solid #383838; border-radius: 18px; box-shadow: 0 16px 50px rgba(0,0,0,.6); padding: 8px; max-height: 60vh; overflow-y: auto; }
.cc-pop .pl { display: grid; gap: 2px; min-width: 300px; }
.cc-pop .ph { font-size: 12px; color: #888; padding: 10px 12px 4px; }
.cc-pop .pi { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; background: none; border: 0; color: #eee; cursor: pointer; text-align: left; font-size: 14px; }
.cc-pop .pi:hover { background: #303030; }
.cc-pop .pi.on { background: #383838; }
.cc-pop .pi.off { color: #666; cursor: not-allowed; }
.cc-pop .pi .mi { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.cc-pop .pn { flex: 1; display: grid; }
.cc-pop .pn .sub { font: 10px var(--mono); color: #777; }
.cc-pop .pt { font-size: 11px; color: #aaa; background: #333; border-radius: 6px; padding: 2px 8px; }
.cc-pop.models { width: 380px; }
.pp { width: 520px; max-width: calc(100vw - 60px); padding: 8px 10px 12px; }
.pp-h { font-size: 13px; color: #aaa; margin: 14px 0 8px; }
.pp-h:first-child { margin-top: 4px; }
.pp-ratios { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.pp-card { height: 74px; border-radius: 12px; border: 1px solid #3a3a3a; background: #2b2b2b; color: #aaa; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 8px; font-size: 12px; }
.pp-card.on { border-color: #fff; color: #fff; background: #333; }
.pp-dur { display: grid; grid-template-columns: 1fr 64px auto; gap: 10px; align-items: center; }
.pp-dur .dur { grid-template-columns: 1fr; } .pp-dur .dur-val, .pp-dur .dur-scale { display: none; }
.pp-num { height: 36px; text-align: center; background: #1d1d1d; border: 1px solid #3a3a3a; border-radius: 9px; }
.pp-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.pp-btn { height: 44px; border-radius: 11px; border: 1px solid #3a3a3a; background: #2b2b2b; color: #aaa; cursor: pointer; font-size: 14px; }
.pp-btn.on { border-color: #fff; color: #fff; background: #333; }
.cc-pop.grid { width: 420px; }
.pg { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.pg-i { background: #2b2b2b; border: 1px solid #3a3a3a; border-radius: 10px; padding: 0; overflow: hidden; cursor: pointer; color: #aaa; font-size: 10px; display: grid; }
.pg-i img, .pg-i .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: grid; place-items: center; }
.pg-i span { padding: 3px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-i:hover { border-color: #fff; }
.cv-hint { display: none; }
@media (max-width: 860px) {
  .cv-composer { bottom: 70px; border-radius: 16px; padding: 10px; }
  .cc-thumb { width: 56px; height: 56px; }
  .cc-sel { height: 36px; font-size: 13px; padding: 0 9px; }
  .cv-dock { left: 8px; bottom: 8px; }
  .cc-pop.models, .cc-pop .pl { width: auto; min-width: 0; }
}

/* 通知改到上方，避免擋住畫布底部的輸入框 */
.toasts { top: 66px; bottom: auto; }
/* 底部輸入框與左下工具列不要互蓋 */
@media (min-width: 1401px) { .cv-composer { width: min(1000px, calc(100% - 560px)); } }
@media (min-width: 861px) and (max-width: 1400px) { .cv-dock { bottom: auto; top: 116px; left: 12px; } }
@media (min-width: 1100px) { body.agent-open .cv-composer { left: calc((100% - 440px) / 2); width: min(1000px, calc(100% - 440px - 32px)); } }
@media (max-width: 860px) {
  .cv-ntool { position: absolute; left: 8px !important; right: 8px; top: 64px !important; transform: none !important; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .cv-composer .cc-prompt { min-height: 0; height: 84px; }
}
/* 素材列拖曳排序、同類編號 */
.cc-thumb { touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .15s ease; }
.cc-thumb.dragging { transition: none; z-index: 3; cursor: grabbing; box-shadow: 0 8px 24px rgba(0,0,0,.6); border-color: #6aa1ff; }
.cc-refs.sorting .cc-thumb .acts { display: none; }
.cc-refs.sorting { overflow: visible; }
.cc-thumb .kn { position: absolute; right: 4px; bottom: 4px; font: 600 10px/14px var(--mono); padding: 0 4px; border-radius: 4px; background: rgba(0,0,0,.7); color: #cfd8e6; }
.cv-stage.space-pan { cursor: grab; }
.cv-stage.space-pan.panning { cursor: grabbing; }
/* 多選外框（LibTV 式） */
.cv-selframe { position: absolute; z-index: 0; border: 1.5px dashed rgba(255,255,255,.45); border-radius: 14px; background: rgba(255,255,255,.035); pointer-events: none; }
.cv-selframe .sf-plus { position: absolute; right: -19px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 1px solid #555; background: #2a2a2a; color: #fff; font-size: 22px; line-height: 1; cursor: crosshair; pointer-events: auto; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.cv-selframe .sf-plus:hover { background: #3a3a3a; border-color: #6aa1ff; }
.cv-menu.group { min-width: 220px; padding: 8px; }
.cv-menu .menu-title { font-size: 12px; color: var(--muted); padding: 6px 10px 8px; }
/* 圖片節點、語音節點 */
.node.imggen .media.imgs { display: grid; gap: 4px; background: #0d0d0d; border-radius: 12px; overflow: hidden; min-height: 160px; }
.node.imggen .media.imgs.n1 { grid-template-columns: 1fr; }
.node.imggen .media.imgs.n2, .node.imggen .media.imgs.n3, .node.imggen .media.imgs.n4 { grid-template-columns: 1fr 1fr; }
.node.imggen .media.imgs img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; outline: 2px solid transparent; outline-offset: -2px; }
.node.imggen .media.imgs.n2 img.pick, .node.imggen .media.imgs.n3 img.pick, .node.imggen .media.imgs.n4 img.pick { outline-color: #6aa1ff; }
.node.imggen .media.imgs .gen-state, .node.ttsgen .media .gen-state { min-height: 160px; }
.node.ttsgen .media.aud { background: #0d0d0d; border-radius: 12px; min-height: 120px; display: grid; place-items: center; }
.node.ttsgen .aud-wrap { width: 100%; padding: 14px; display: grid; gap: 10px; }
.node.ttsgen .aud-txt { font-size: 12px; color: var(--muted); line-height: 1.5; }
.node.ttsgen audio { width: 100%; }
.cv-menu button:disabled { opacity: .4; cursor: not-allowed; }
.img-grid { display: grid; gap: 3px; width: 100%; height: 100%; }
.img-grid.n2, .img-grid.n3, .img-grid.n4 { grid-template-columns: 1fr 1fr; }
.img-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* ===== 首頁、專案（LibTV 式） ===== */
.home { overflow-y: auto; }
.home-wrap { max-width: 1280px; margin: 0 auto; padding: 24px 28px 60px; }
.home-hero { width: 100%; min-height: 190px; display: grid; place-items: center; align-content: center; gap: 10px; border-radius: 18px; cursor: pointer;
  border: 1px solid var(--line); color: var(--text);
  background: radial-gradient(circle, rgba(255,255,255,.07) 1px, transparent 1.4px) 0 0 / 22px 22px, linear-gradient(180deg, #1a1a1a, #151515); }
.home-hero:hover { border-color: var(--line-2); }
.hero-plus { width: 88px; height: 52px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 34px; font-weight: 300; line-height: 1; }
.hero-t { font-size: 17px; font-weight: 600; }
.home-tiles { display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px; margin: 26px 0 8px; }
.tile { display: grid; justify-items: center; gap: 10px; background: none; border: 0; color: var(--text); cursor: pointer; font-size: 14px; }
.tile-i { width: 100%; max-width: 112px; height: 62px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; font-size: 22px; transition: background .15s; }
.tile:hover .tile-i { background: var(--panel-2); border-color: var(--line-2); }
.home-sec { display: flex; align-items: baseline; gap: 12px; margin: 30px 2px 14px; }
.home-sec h2 { font-size: 17px; font-weight: 600; margin: 0; flex: 1; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; }
.link:hover { color: var(--text); }
.pj-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pj-card { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; color: var(--text); text-align: left; min-width: 0; }
.pj-grid .pj-card { flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; }
.pj-card:hover, .cv-card:hover, .guide-card:hover, .feat-card:hover { border-color: var(--line-2); background: #202020; }
.pj-cover { width: 96px; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: #0e0e0e; flex: none; display: grid; place-items: center; }
.pj-grid .pj-cover { width: 100%; aspect-ratio: 16/9; border-radius: 0; }
.pj-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-ph { font-size: 28px; font-weight: 700; color: var(--faint); }
.pj-meta { min-width: 0; display: grid; gap: 3px; }
.pj-grid .pj-meta { padding: 12px 14px 14px; }
.pj-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pj-card.new .pj-cover { background: #141414; }
.pj-card.new .hero-plus { width: 54px; height: 40px; font-size: 26px; }
.pj-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 20px; }
.pj-head h2 { margin: 0; font-size: 20px; }
.cv-card { display: grid; gap: 6px; justify-items: start; padding: 18px; min-height: 130px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; color: var(--text); text-align: left; }
.cv-card.new { border-style: dashed; justify-items: center; align-content: center; color: var(--muted); }
.cvc-i { font-size: 22px; color: var(--muted); }
.guide-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.guide-card { position: relative; display: grid; gap: 6px; align-content: start; text-align: left; padding: 18px 18px 40px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; color: var(--text); }
.gc-n { font: 600 12px var(--mono); color: var(--faint); }
.gc-t { font-size: 15px; font-weight: 600; }
.gc-go { position: absolute; left: 18px; bottom: 14px; font-size: 12px; color: var(--muted); }
.feat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feat-card { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; row-gap: 3px; text-align: left; padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; color: var(--text); }
.fc-i { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; font-size: 20px; }
.fc-t { font-weight: 600; }
.guide-modal { max-width: 560px; }
.gm-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.gm-head h3 { margin: 0; }
.gm-n { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; flex: none; }
.gm-steps { margin: 10px 0 4px; padding-left: 22px; display: grid; gap: 12px; }
.gm-steps li::marker { color: var(--muted); font-family: var(--mono); }
.gm-steps b { display: block; margin-bottom: 2px; }
.empty-line { grid-column: 1 / -1; padding: 18px 4px; }
.cv-proj { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) {
  .home-tiles { grid-template-columns: repeat(4, 1fr); }
  .pj-row { grid-template-columns: repeat(2, 1fr); }
  .guide-row, .feat-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .home-wrap { padding: 14px 14px 40px; }
  .home-hero { min-height: 140px; }
  .home-tiles { gap: 10px; }
  .tile { font-size: 12px; }
  .tile-i { height: 52px; }
  .pj-row, .guide-row, .feat-row { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs button { flex: none; }
}
