:root {
  --bg: #f7f5f1;
  --panel: #ffffff;
  --panel-2: #efece6;
  --line: #e0dbd2;
  --text: #24201a;
  --muted: #736b5f;
  --accent: #c26a14;
  --accent-text: #ffffff;
  --danger: #c03a3a;
  --c0: #7e3528;
  --c1: #235a60;
  --c2: #4e3f85;
  --c3: #7f5f14;
  --c4: #33603c;
  --c5: #813a5d;
  --c6: #2b4873;
  --ok: #1f7a45;
  --info: #2460a7;
  --violet: #6b4bb0;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #17141f;
  --panel: #1f1b29;
  --panel-2: #2a2537;
  --line: #3a3349;
  --text: #ece7f5;
  --muted: #9a91ad;
  --accent: #f0a24a;
  --accent-text: #221c2e;
  --danger: #ff6b6b;
  --ok: #6fcf97;
  --info: #7db4f0;
  --violet: #b9a0f0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 12px; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

button, .button {
  display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit;
}
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0 8px 0 0; }
textarea { resize: vertical; }
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
label.check { display: flex; align-items: center; color: var(--text); font-size: 15px; }

.topbar {
  display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); }
.brand img { width: 28px; height: 28px; }
.brand b, .auth-logo b { color: var(--accent); }
.auth-logo { display: flex; align-items: center; gap: 10px; }
.auth-logo img { width: 56px; height: 56px; }
.topbar nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topbar nav a { display: flex; align-items: center; gap: 5px; padding: 6px 8px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
.tab-icon { display: flex; }
.tab-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar nav a.on .tab-icon { color: var(--accent); }
@media (max-width: 1480px) {
  .topbar nav a:not(.on) span:last-child { display: none; }
}
.topbar nav a.on { background: var(--panel-2); color: var(--text); }
.topbar .right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }

.page { max-width: 880px; margin: 0 auto; padding: 24px 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.auth { max-width: 380px; margin: 10vh auto 0; padding: 0 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile { display: block; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.tile:hover { border-color: var(--accent); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 12px; }
.code { display: block; padding: 10px; border-radius: 8px; background: var(--panel-2); font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; }

.split { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 52px); }
.side { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel); border-right: 1px solid var(--line); overflow: hidden; }
.filters { display: grid; gap: 6px; }
.cat-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-tools button { flex: 1; padding: 4px 8px; font-size: 13px; }
.cat { border-radius: 8px; }
.cat.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--panel-2); }
.cat-head { display: flex; align-items: center; gap: 4px; }
.cat-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 5px 6px; border: 0; background: none; color: inherit; text-align: left; font-weight: 600; }
.cat-toggle:hover { background: var(--panel-2); }
.cat-arrow { flex: none; font-size: 11px; color: var(--muted); transition: transform .12s; }
.cat.open .cat-arrow { transform: rotate(90deg); }
.cat-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cat-edit { flex: none; padding: 2px 8px; border: 0; background: none; color: var(--muted); }
.cat-edit:hover { background: var(--panel-2); color: var(--text); }
.cat-items { display: flex; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.cat-empty { margin: 2px 8px 6px; font-size: 13px; }
.item-row { position: relative; display: flex; align-items: center; }
.item-row .item { flex: 1; min-width: 0; }
.item-move { position: absolute; right: 4px; padding: 2px 7px; opacity: 0; }
.item-row:hover .item-move, .item-move:focus-visible { opacity: 1; }
@media (hover: none) { .item-move { opacity: 1; } }
.gallery-groups .cat { margin-top: 18px; padding: 4px; }
.gallery-groups .cat-toggle { font-size: 16px; }
.gallery-groups .gallery { margin-top: 8px; }
.gallery-card[draggable="true"] { cursor: grab; }
.items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: inherit; }
.item:hover { background: var(--panel-2); }
.item.on { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.item .title { overflow-wrap: anywhere; }
.main { min-width: 0; overflow-y: auto; padding: 22px 28px; }
.main.flush { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.objbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.objbar h1 { margin: 0; font-size: 17px; flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.main:not(.flush) > .objbar { margin: -22px -28px 22px; }
.thumb-frame { position: fixed; left: -9999px; top: 0; width: 320px; height: 320px; border: 0; }
.viewer { flex: 1; width: 100%; border: 0; background: #17141f; }

.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.editor textarea { min-height: 60vh; font: 14px/1.5 ui-monospace, Consolas, monospace; }
.prose { overflow-wrap: anywhere; }
.prose img { max-width: 100%; }
.prose pre { padding: 12px; border-radius: 8px; background: var(--panel-2); overflow-x: auto; }
.prose table { border-collapse: collapse; }
.prose td, .prose th { border: 1px solid var(--line); padding: 4px 10px; }

table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { color: var(--muted); font-size: 13px; font-weight: 500; }

.backdrop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgb(0 0 0 / .45); z-index: 10; }
.dialog { width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; background: var(--panel); border-radius: 14px; padding: 20px; }
.choice { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; color: var(--text); font-size: 15px; cursor: pointer; }
.choice.on { border-color: var(--accent); }
.choice small { display: block; color: var(--muted); }

.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--panel-2); }
.segmented button { padding: 5px 12px; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.segmented button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .18); }

.menu { position: relative; }
.menu-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 9; width: 280px; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text);
  box-shadow: 0 10px 30px rgb(0 0 0 / .25); white-space: normal;
}
.menu-panel h3 { margin: 12px 0 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.menu-panel h3:first-child { margin-top: 0; }
.menu-panel .muted { margin: 6px 0 0; }
.menu-links { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

.steps { display: flex; flex-direction: column; gap: 2px; }
.steps b { margin-bottom: 4px; }
.steps button { position: relative; padding: 4px 0 4px 24px; border: 0; background: none; color: inherit; font-size: 14px; text-align: left; }
.steps button::before { content: ''; position: absolute; left: 2px; top: 8px; width: 13px; height: 13px; border: 1.5px solid currentColor; border-radius: 3px; }
.steps button:not(:disabled):hover { text-decoration: underline; }
.steps button.done { opacity: .65; text-decoration: line-through; }
.steps button.done::before { background: currentColor; }

.history-line { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 0; overflow-wrap: anywhere; }
.history-line > div { flex: 1 1 200px; min-width: 0; }
.history-line time { flex: none; width: 42px; color: var(--muted); font-size: 13px; line-height: 22px; }
.change-mark { --mark: var(--muted); display: inline-flex; flex: none; align-items: center; gap: 4px; align-self: flex-start; min-width: 92px; padding: 1px 8px; border-radius: 6px; background: color-mix(in srgb, var(--mark) 14%, transparent); color: var(--mark); font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap; }
.change-mark.created, .change-mark.joined, .change-mark.decided { --mark: var(--ok); }
.change-mark.updated { --mark: var(--info); }
.change-mark.deleted { --mark: var(--danger); }
.change-mark.shared, .change-mark.published { --mark: var(--violet); }
.change-mark.reverted { --mark: var(--accent); }
.diff-created { color: var(--ok); }
.diff-updated { color: var(--text); }
.diff-deleted { color: var(--danger); }
.viewer-list { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 12px; }
.history-day { margin-bottom: 20px; }
.history-day h2 { position: sticky; top: 0; margin-bottom: 6px; padding: 4px 0; background: var(--bg); font-size: 15px; }

.home { position: relative; max-width: 1040px; }
.home h1 { margin-bottom: 14px; font-size: 28px; }
.home-search { padding: 12px 16px; border-radius: 12px; font-size: 16px; margin-bottom: 14px; }
.home > .steps { flex-flow: row wrap; align-items: center; gap: 4px 22px; margin-bottom: 16px; padding: 10px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.home > .steps b { margin: 0; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.home-row { display: flex; align-items: center; gap: 12px; margin: 0 -8px; padding: 8px; border-radius: 10px; color: inherit; }
.home-row:hover { background: var(--panel-2); }
.home-row .title { overflow-wrap: anywhere; }
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.tool-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.tool-card p { flex: 1; margin: 0; font-size: 14px; }
.tool-head { display: flex; align-items: center; gap: 10px; }
.tool-head h2 { flex: 1; margin: 0; font-size: 17px; }
.tool-head h2 a { color: inherit; }
.tool-pictures { display: flex; gap: 6px; }
.tool-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
.tool-actions > :only-child:not(.primary) { margin-left: auto; }
a.button { display: inline-block; padding: 6px 12px; border-radius: 8px; }
a.button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
a.button.primary:hover { text-decoration: none; filter: brightness(1.08); }
.pic { display: grid; flex: none; place-items: center; width: 44px; height: 44px; overflow: hidden; border-radius: 8px; background: var(--panel-2); }
.pic svg { width: 60%; height: 60%; }
.pic svg * { fill: var(--swatch); }
.pic img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pic.effect img { object-fit: cover; }
.pic.model .top { filter: brightness(1.3); }
.pic.model .right { filter: brightness(.72); }
.pic .fold { fill: rgb(255 255 255 / .35); }
.main:has(> .gallery-groups) .empty { max-width: none; margin: 0; text-align: left; }
.main:has(> .gallery-groups) .empty h2 { margin-top: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-top: 18px; }
.gallery-card { display: block; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: inherit; }
.gallery-card:hover { border-color: var(--accent); text-decoration: none; }
.gallery-card .pic { width: 100%; height: auto; aspect-ratio: 1; margin-bottom: 8px; }
.gallery-card .pic svg { width: 40%; height: 40%; }
.gallery-card .title { overflow-wrap: anywhere; font-weight: 600; }
.gallery-card .muted { font-size: 13px; }
.home-people { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.home-person { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); font-weight: 600; }

.drop-hint {
  position: fixed; inset: 68px 16px 16px; z-index: 6; display: none; place-items: center;
  border: 3px dashed var(--accent); border-radius: 14px; background: rgb(0 0 0 / .45);
  color: #fff; font-size: 22px; font-weight: 600; pointer-events: none;
}
.dragging > .drop-hint { display: grid; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: 90vw; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); z-index: 20; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; grid-template-rows: 40vh minmax(0, 1fr); height: auto; min-height: calc(100vh - 52px); }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 16px; }
  .main:not(.flush) > .objbar { margin: -16px -16px 16px; }
  .main.flush { min-height: 70vh; }
  .editor { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .wide, .brand { display: none; }
  .tool-grid, .home-grid { grid-template-columns: 1fr; }
}

.save-box { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.save-note { width: 180px; padding: 5px 8px; }
.empty { max-width: 560px; margin: 8vh auto; text-align: center; }

.main.doc-main { padding: 0; }
.doc-edit { display: flex; flex-direction: column; min-height: 100%; }
.doc-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 24px 8px; }
.doc-title { flex: 1; min-width: 200px; padding: 4px 0; border: 0; border-radius: 0; background: none; font-size: 26px; font-weight: 700; }
.doc-title:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.toolbar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.toolbar button, .bubble button { min-width: 32px; padding: 3px 8px; border-color: transparent; background: none; border-radius: 6px; font-size: 14px; }
.toolbar button:hover, .bubble button:hover { background: var(--panel-2); }
.toolbar button.on, .bubble button.on { background: var(--panel-2); color: var(--accent); }
.tool-gap { width: 1px; height: 18px; margin: 0 6px; background: var(--line); }
.table-tools { top: 41px; background: var(--panel-2); }
.draft-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 24px; background: var(--panel-2); font-size: 14px; }
.doc-columns { display: grid; grid-template-columns: minmax(0, 760px) 200px; gap: 32px; justify-content: center; flex: 1; width: 100%; padding: 16px 24px 40px; }
.main:not(.doc-main) .doc-columns { padding: 0; justify-content: start; }
.doc-surface .tiptap { min-height: 55vh; outline: none; }
.doc-source { width: 100%; min-height: 60vh; font: 14px/1.6 ui-monospace, Consolas, monospace; }
.tiptap p.is-empty::before { content: attr(data-placeholder); float: left; height: 0; color: var(--muted); pointer-events: none; }
.outline { position: sticky; top: 56px; align-self: start; display: flex; flex-direction: column; gap: 3px; max-height: calc(100vh - 120px); overflow-y: auto; font-size: 13px; }
.outline a { color: var(--muted); overflow-wrap: anywhere; }
.outline a:hover { color: var(--text); }
.outline .level-2 { padding-left: 10px; }
.outline .level-3 { padding-left: 20px; }
.doc-foot { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 8px 24px; border-top: 1px solid var(--line); background: var(--panel); }
.doc-foot input { flex: 1; }
.bubble { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); box-shadow: 0 8px 24px rgb(0 0 0 / .25); }
.slash-menu { position: fixed; z-index: 30; display: flex; flex-direction: column; gap: 1px; width: 280px; max-height: 320px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: 0 12px 32px rgb(0 0 0 / .28); }
.slash-menu button { display: flex; align-items: center; gap: 10px; padding: 5px 7px; border: 0; border-radius: 7px; background: none; text-align: left; }
.slash-menu button.on, .slash-menu button:hover { background: var(--panel-2); }
.slash-menu i { display: grid; place-items: center; flex: none; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; font-style: normal; font-size: 13px; }
.slash-menu small { display: block; color: var(--muted); font-size: 12px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.dialog:has(.template-grid) { max-width: 620px; }
.template { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 10px; text-align: left; }
.template.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.template i { font-style: normal; font-size: 20px; }
.template small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.prose ul[data-type="taskList"] { padding-left: 0; list-style: none; }
.prose ul[data-type="taskList"] li { display: flex; gap: 8px; }
.prose ul[data-type="taskList"] li > div { flex: 1; }
.prose ul[data-type="taskList"] p { margin: 0; }
.prose blockquote { margin: 12px 0; padding: 2px 14px; border-left: 3px solid var(--line); color: var(--muted); }
.prose mark { padding: 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; }
.prose table { width: 100%; }
.prose th { background: var(--panel-2); text-align: left; }
.prose .selectedCell { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.prose .ProseMirror-selectednode { outline: 2px solid var(--accent); }
.prose .callout { margin: 12px 0; padding: 8px 14px; border: 0; border-left: 4px solid var(--callout); border-radius: 8px; background: color-mix(in srgb, var(--callout) 12%, transparent); color: inherit; }
.prose .callout p { margin: 6px 0; }
.prose .callout[data-kind="NOTE"] { --callout: #3a7bd5; }
.prose .callout[data-kind="TIP"] { --callout: #3c9a5f; }
.prose .callout[data-kind="IMPORTANT"] { --callout: #c99a1e; }
.prose .callout[data-kind="WARNING"] { --callout: #d0453f; }
.menu-panel.more { display: flex; flex-direction: column; gap: 2px; width: 220px; padding: 6px; }
.menu-panel.more button { padding: 6px 10px; border: 0; background: none; text-align: left; }
.menu-panel.more button:hover { background: var(--panel-2); }
a.button.primary-link { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

@media (max-width: 1100px) {
  .doc-columns { grid-template-columns: minmax(0, 1fr); }
  .outline { display: none; }
}

.prose li:has(> input[type="checkbox"]) { list-style: none; margin-left: -18px; }
.notice { padding: 8px 12px; border-left: 3px solid var(--accent); border-radius: 6px; background: var(--panel-2); }
.skill-page { max-width: 760px; }
.skill-about { font-size: 17px; }
.skill-files { margin: 0 0 12px; padding: 0; list-style: none; }
.skill-files li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 760px) {
  .doc-title { flex-basis: 100%; }
  .doc-columns { padding: 12px 16px 24px; }
  .toolbar, .doc-actions, .doc-foot, .draft-bar { padding-left: 16px; padding-right: 16px; }
}

.table-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 16px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.table-banner.live { border-left: 4px solid var(--ok); }
.table-banner.frozen { border-left: 4px solid var(--muted); }
.table-banner.draft { border-left: 4px solid var(--accent); }
.sheet-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-tools input[type="search"] { margin-left: auto; width: 200px; max-width: 100%; }
.sheet-tools [hidden] { display: none; }
.missing-count { color: var(--accent); border-color: var(--accent); }
.version-select { width: auto; max-width: 220px; }
.table-bar button.on { border-color: var(--accent); color: var(--accent); }
.cell-hint { display: flex; align-items: baseline; gap: 12px; min-height: 30px; padding: 6px 16px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--panel); overflow: hidden; white-space: nowrap; }
.cell-hint > * { overflow: hidden; text-overflow: ellipsis; }
.cell-hint b { flex: none; max-width: 40%; }
.cell-hint .no-text { color: var(--accent); }
.table-work { flex: 1; display: flex; min-height: 0; }
.table-sheet { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.table-panel { flex: none; width: 340px; padding: 12px 14px; overflow: auto; border-left: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.table-panel h2 { margin: 0; font-size: 15px; }
.table-panel[hidden] { display: none; }
.sheet-grid { flex: 1; min-height: 0; overflow: auto; position: relative; outline: none; background: var(--panel); font-size: 13px; }
.grid-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: var(--cols) 36px; width: max-content; min-width: 100%; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.grid-corner { position: sticky; left: 0; z-index: 2; background: var(--panel-2); border-right: 1px solid var(--line); cursor: pointer; }
.grid-col { position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 8px; background: var(--panel-2); border-right: 1px solid var(--line); font-weight: 600; cursor: pointer; user-select: none; }
.grid-col.pin-enabled { position: sticky; left: 48px; z-index: 2; }
.grid-col.pin-id { position: sticky; left: var(--pin-id); z-index: 2; }
.col-type { color: var(--muted); font-size: 11px; font-weight: 400; }
.col-key { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-missing { color: var(--accent); }
.col-more { display: none; padding: 0 4px; border: 0; background: none; line-height: 1; }
.grid-col:hover .col-more { display: block; }
.col-resize { position: absolute; top: 0; right: -3px; bottom: 0; width: 7px; cursor: col-resize; z-index: 1; }
.col-add { border: 0; background: none; color: var(--muted); }
.grid-body { position: relative; }
.grid-row { position: absolute; left: 0; display: grid; grid-template-columns: var(--cols); height: var(--row-h); width: max-content; }
.grid-row.off .cell:not(.index) { color: var(--muted); background: var(--panel-2); }
.cell { height: var(--row-h); padding: 0 8px; line-height: calc(var(--row-h) - 1px); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; user-select: none; }
.cell.number { text-align: right; font-variant-numeric: tabular-nums; }
.cell.bool { text-align: center; }
.cell.index { position: sticky; left: 0; z-index: 1; padding: 0 4px; text-align: center; color: var(--muted); background: var(--panel-2); cursor: pointer; }
.cell.pin-enabled { position: sticky; left: 48px; z-index: 1; }
.cell.pin-id { position: sticky; left: var(--pin-id); z-index: 1; font-weight: 600; box-shadow: 1px 0 0 var(--line); }
.cell.missing { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.cell.sel { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); }
.cell.index.sel { color: var(--text); }
.cell.cursor { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell-check { display: inline-block; width: 15px; height: 15px; vertical-align: middle; border: 1.5px solid var(--muted); border-radius: 3px; cursor: pointer; }
.cell-check.on { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--panel); }
.cell-input { position: absolute; z-index: 4; padding: 0 7px; border: 2px solid var(--accent); border-radius: 0; background: var(--panel); color: var(--text); font: inherit; font-size: 13px; outline: none; }
.sheet-tabs { display: flex; align-items: center; gap: 2px; padding: 4px 8px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--panel-2); }
.sheet-tab { display: flex; gap: 6px; flex: none; padding: 4px 12px; border: 0; border-radius: 6px; background: none; }
.sheet-tab.on { background: var(--panel); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.sheet-add { flex: none; padding: 4px 10px; border: 0; background: none; color: var(--muted); }
.version-card, .change-card { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.version-card.on { border-color: var(--accent); }
.version-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.version-actions button { padding: 3px 8px; font-size: 12px; }
.change-card > button { align-self: flex-start; padding: 3px 8px; font-size: 12px; }
.status-live { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.status-draft { color: var(--accent); }
.diff-list { display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; font-size: 12px; }
.dialog .diff-list { max-height: 45vh; overflow: auto; }
.json-preview { max-height: 60vh; overflow: auto; margin: 0; padding: 10px; border-radius: 8px; background: var(--panel-2); font-size: 12px; }
.game-link { width: 100%; font-size: 12px; }
button.link { padding: 0; border: 0; background: none; color: var(--accent); }
@media (max-width: 760px) {
  .table-panel { position: fixed; inset: auto 0 0 0; width: auto; max-height: 70vh; z-index: 5; border-top: 1px solid var(--line); border-left: 0; }
  .table-work { flex: none; height: 75vh; }
  .cell-hint { white-space: normal; flex-wrap: wrap; }
  .sheet-tools input[type="search"] { margin-left: 0; width: 100%; }
}

.question-list { display: flex; flex-direction: column; gap: 10px; }
.question-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: var(--panel); color: var(--text); }
.question-card:hover { border-color: var(--accent); }
.decision-line { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; }
.decision-box { margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--ok); border-radius: 12px; background: color-mix(in srgb, var(--ok) 8%, var(--panel)); }
.decision-box p { margin: 8px 0 4px; font-size: 16px; }
.decision-box p.muted { font-size: 14px; }
.option-card { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.option-card.chosen { border-color: var(--ok); }
.option-card > button { align-self: flex-start; }
.status-open { color: var(--accent); }
.status-decided { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }

.audio-page { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; padding: 14px 16px; overflow-y: auto; }
.audio-transport, .audio-ab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.audio-clock { font-variant-numeric: tabular-nums; font-weight: 600; }
.audio-level { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.audio-level.over { color: var(--danger); }
.audio-zoom { display: flex; gap: 4px; margin-left: auto; }
.audio-wave { flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.audio-canvas { display: block; touch-action: none; }
.audio-scroll { display: block; width: 100%; margin: 0; padding: 0; }
.audio-page button.on { border-color: var(--accent); color: var(--accent); }
.audio-tools { display: flex; flex-wrap: wrap; gap: 14px 24px; }
.audio-group { display: flex; flex-direction: column; gap: 6px; }
.audio-group > .muted { font-size: 13px; }
.audio-group .row { gap: 6px; }

.board-body { display: flex; flex: 1; min-height: 0; }
.board-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; }
.board-canvas { position: absolute; inset: 0; overflow: hidden; outline: none; cursor: default; touch-action: none; user-select: none; background-color: var(--panel-2); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 24px 24px; }
.board-canvas[data-tool="hand"], .board-canvas.panning { cursor: grab; }
.board-canvas[data-tool="link"], .board-canvas[data-tool="comment"] { cursor: crosshair; }
.board-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.board-screen { position: absolute; box-shadow: 0 2px 14px rgb(0 0 0 / .22); background: var(--panel); }
.board-screen.on { outline: calc(2px / var(--zoom, 1)) solid var(--accent); }
.board-screen img { display: block; width: 100%; height: 100%; pointer-events: none; }
.board-screen-name { position: absolute; left: 0; bottom: 100%; max-width: 100%; padding-bottom: calc(4px / var(--zoom, 1)); overflow: hidden; color: var(--muted); font-size: calc(12px / var(--zoom, 1)); line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.board-screen.on .board-screen-name { color: var(--accent); }
.board-screen-blank { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: calc(13px / var(--zoom, 1)); }
.board-hotspot { position: absolute; border: calc(1.5px / var(--zoom, 1)) solid var(--accent); border-radius: calc(3px / var(--zoom, 1)); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.board-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.board-link { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.board-link.on { stroke-width: 3; }
.board-arrow { fill: var(--accent); }
.board-link-hit { fill: none; stroke: transparent; pointer-events: stroke; cursor: pointer; }
.board-canvas[data-tool="link"] .board-link-hit, .board-canvas[data-tool="comment"] .board-link-hit { pointer-events: none; }
.board-guides { position: absolute; inset: 0; pointer-events: none; }
.board-guide { position: absolute; left: 0; right: 0; height: 1px; background: var(--danger); }
.board-guide.vertical { left: auto; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
.board-pin { position: absolute; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 2px solid #fff; border-radius: 50% 50% 50% 0; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; transform: translate(0, -100%) scale(calc(1 / var(--zoom, 1))); transform-origin: 0 100%; }
.board-empty { position: absolute; left: 50%; top: 42%; width: min(420px, 80%); transform: translate(-50%, -50%); text-align: center; pointer-events: none; }
.board-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); max-width: 90%; padding: 7px 14px; border-radius: 99px; background: var(--text); color: var(--bg); font-size: 13px; }
.board-toolbar { position: absolute; left: 50%; bottom: 14px; display: flex; align-items: center; gap: 3px; max-width: calc(100% - 20px); padding: 5px; overflow-x: auto; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: 0 4px 18px rgb(0 0 0 / .18); }
.board-toolbar button { flex: none; min-width: 34px; padding: 5px 8px; border: 0; background: none; color: inherit; }
.board-toolbar button:hover:not(:disabled) { background: var(--panel-2); }
.board-toolbar button.on { background: var(--accent); color: #fff; }
.board-toolbar button:disabled { opacity: .4; }
.board-toolbar-gap { flex: none; width: 1px; height: 20px; margin: 0 4px; background: var(--line); }
.board-side { flex: none; display: flex; flex-direction: column; width: 280px; border-left: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.board-side-tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.board-side-tabs button { flex: 1; padding: 5px 6px; border: 0; background: none; color: var(--muted); font-size: 13px; }
.board-side-tabs button.on { background: var(--panel-2); color: var(--text); }
.board-side-body, .board-comments { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 12px; overflow-y: auto; }
.board-side-title { margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 600; }
.board-side-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 0; font-size: 13px; }
.board-side-row button { padding: 0 7px; border: 0; background: none; color: var(--muted); }
.board-side-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.board-side-actions > * { padding: 4px 9px; font-size: 13px; }
.board-side-list { display: flex; flex-direction: column; gap: 1px; }
.board-side-item { padding: 5px 7px; border: 0; background: none; color: inherit; text-align: left; font-size: 13px; overflow-wrap: anywhere; }
.board-side-item:hover { background: var(--panel-2); }
.board-comment { padding: 9px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.board-comment.on { border-color: var(--accent); }
.board-comment.resolved { opacity: .6; }
.board-comment p { margin: 5px 0 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.board-comment .row { gap: 6px; }
.board-comment .row button { padding: 3px 8px; font-size: 12px; }
.board-comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.board-comment-pin { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.proto { position: fixed; inset: 0; z-index: 15; display: flex; flex-direction: column; background: #111; color: #eee; }
.proto-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 14px; background: #1c1c1c; }
.proto-bar .muted { flex: 1; min-width: 120px; color: #999; font-size: 13px; }
.proto-bar button { background: #2a2a2a; color: #eee; border-color: #444; }
.proto-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.proto-frame { position: relative; }
.proto-frame img { display: block; width: 100%; height: 100%; }
.proto-hotspot { position: absolute; padding: 0; border: 0; border-radius: 3px; background: transparent; cursor: pointer; }
.proto-stage.flash .proto-hotspot { background: rgb(240 162 74 / .28); outline: 2px solid rgb(240 162 74 / .8); }

@media (max-width: 760px) {
  .board-body { flex-direction: column; }
  .board-stage { min-height: 56vh; }
  .board-side { width: auto; max-height: 40vh; border-left: 0; border-top: 1px solid var(--line); }
}
