/* ============================================================================
   OneCanvas · standalone canvas shell redesign (ADDITIVE)
   ----------------------------------------------------------------------------
   Load order (public/prototype/onecanvas_ko.html <head>):
     1. existing <link>s (diagram-studio, onboarding, onecanvas-ai-connect)
     2. existing inline <style> … </style>
     3. <link rel="stylesheet" href="/prototype/onecanvas-tokens.css">
     4. <link rel="stylesheet" href="/prototype/onecanvas-shell-redesign.css">   ← this file
     5. <link rel="stylesheet" href="/prototype/onecanvas-ai-connect-redesign.css">
   It must come AFTER the inline block: every selector below mirrors the engine's
   own specificity so a later position is what makes it win. No element IDs,
   event hooks, or geometry the JS depends on (card-head 28px, #world, #selbox
   handles, layers z-index) are changed. Canvas content (.k-text bodies, card
   inner content) keeps its font metrics — only the shell is restyled.
   ============================================================================ */

/* 0 · Retone the engine variables so every existing rule picks up the system */
:root {
  --accent: var(--oc-accent);
  --accent-weak: var(--oc-accent-soft);
  --danger: var(--oc-danger);
  --leftw: 272px;
  --rightw: 288px;
  --oc-topbar-h: 48px;
  --oc-bottombar-h: 36px;
}
:root[data-theme="dark"] {
  --surface-0: var(--oc-bg);
  --surface-1: var(--oc-surface);
  --surface-2: var(--oc-surface-2);
  --surface-3: var(--oc-surface-3);
  --line: var(--oc-line);
  --text-1: var(--oc-text);
  --text-2: var(--oc-text-2);
  --grid-dot: var(--oc-grid-dot);
}
:root[data-theme="light"] {
  --surface-0: var(--oc-surface-2);
  --surface-1: var(--oc-surface);
  --surface-2: var(--oc-surface-2);
  --surface-3: var(--oc-surface-3);
  --line: var(--oc-line);
  --text-1: var(--oc-text);
  --text-2: var(--oc-text-2);
  --grid-dot: var(--oc-grid-dot);
}
body { font-family: var(--oc-font); }

/* Shell chrome reads at 14px; the stage (card content) keeps the engine's 13px base. */
#topbar, #left, #right, #bottombar, #quickDock, #penOptions, #chatPanel, #activityPanel,
#insertMenu, #globalSearch, .modal-card, #showcaseReplay, #experienceTasks, #experienceNav,
#focusTop, #toasts { font-size: var(--oc-fs-ui); }

#topbar :focus-visible, #left :focus-visible, #right :focus-visible, #bottombar :focus-visible,
#quickDock :focus-visible, #insertMenu :focus-visible, #globalSearch :focus-visible,
.modal-card :focus-visible, #showcaseReplay :focus-visible, #experienceTasks :focus-visible,
#activityPanel :focus-visible, #chatPanel :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: none; }

/* 1 · Frame */
#app { grid-template-rows: var(--oc-topbar-h) 1fr var(--oc-bottombar-h); }
input, textarea, select { border-radius: var(--oc-r-control); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: var(--oc-focus-ring); }

/* 2 · Topbar — single command row */
#topbar { gap: 6px; padding: 0 10px 0 8px; background: var(--surface-1); border-bottom: 1px solid var(--line); }
#topbar .logo { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 2px; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
#topbar .logo::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 6px; background: var(--accent); box-shadow: inset 0 0 0 5px var(--surface-1), inset 0 0 0 6px var(--accent); }
#topbar .logo .ver { color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 600; vertical-align: 0; margin-left: 0; }
.doc-title { width: clamp(160px, 22vw, 320px); height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--oc-r-control); background: transparent; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.doc-title:hover { border-color: var(--line); background: var(--surface-2); }
.doc-title:focus { border-color: var(--accent); background: var(--surface-2); box-shadow: var(--oc-focus-ring); }
#topbar .save-status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px; border-radius: var(--oc-r-pill); background: var(--surface-2); color: var(--text-2); font-size: var(--oc-fs-meta); font-weight: 500; }
#topbar .save-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-2); opacity: .6; }
#topbar .save-status[data-state="saved"]::before, #topbar .save-status[data-state="synced"]::before { background: var(--oc-ok); opacity: 1; }
#topbar .save-status[data-state="saving"]::before, #topbar .save-status[data-state="pending"]::before { background: var(--accent); opacity: 1; }
#topbar .save-status[data-state="error"], #topbar .save-status[data-state="offline"] { color: var(--oc-danger-text); background: var(--oc-danger-soft); }
#topbar .save-status[data-state="error"]::before, #topbar .save-status[data-state="offline"]::before { background: var(--oc-danger); opacity: 1; }
#topbar .save-status:empty { display: none; }
.tbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--oc-r-control); color: var(--text-2); font-weight: 600; transition: background var(--oc-motion-fast) var(--oc-ease), color var(--oc-motion-fast) var(--oc-ease); }
.tbtn:hover { color: var(--text-1); background: var(--surface-2); }
.tbtn:active { background: var(--surface-3); }
.tbtn[aria-expanded="true"] { color: var(--text-1); background: var(--surface-3); }
.tbtn:disabled, .tbtn[aria-disabled="true"], .tbtn[data-coming-soon="true"] { color: var(--text-2); opacity: .55; cursor: not-allowed; background: transparent; }
.tbtn[data-coming-soon="true"]::after, .tbtn[aria-disabled="true"]::after { content: "준비 중"; padding: 2px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 700; line-height: 1.2; }
.global-search-trigger { min-width: 190px; justify-content: flex-start; border: 1px solid var(--line); background: var(--surface-0); color: var(--text-2); font-weight: 500; }
.global-search-trigger::before { content: "⌕"; color: var(--text-2); font-size: 17px; }
.global-search-trigger:hover { border-color: var(--oc-line-strong); background: var(--surface-0); color: var(--text-1); }
#topbar .live-web { border-color: transparent; background: transparent; }
#topbar .live-web .live-dot { display: none; }
#topbar .live-web::before { content: "▶"; color: #ff0033; font-size: 10px; }
.presence { gap: 4px; margin-right: 2px; }
.chip { height: 28px; padding: 0 10px 0 8px; gap: 6px; border-radius: var(--oc-r-pill); color: var(--text-1); font-size: var(--oc-fs-meta); font-weight: 600; background: var(--surface-2); border-color: transparent; }
.chip .dot { width: 8px; height: 8px; }
.chip.idle { opacity: .5; }
.activity-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-3); color: var(--text-1); font-size: var(--oc-fs-micro); font-weight: 700; }
#btnAiSettings.ai-connect-top-trigger { color: var(--accent); border: 1px solid var(--oc-accent-line); background: var(--oc-accent-soft); }
#btnAiSettings.ai-connect-top-trigger::before { content: "✦"; font-size: 13px; }
#btnAiSettings.ai-connect-top-trigger:hover, #btnAiSettings.ai-connect-top-trigger[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--oc-accent-soft); }

/* Optional overflow group (markup change B in canvas-shell.markup-changes.md).
   Wrap #btnHelp #btnDrive #btnImport #btnExport #btnTheme in
   <div class="topbar-overflow"><button class="tbtn topbar-overflow-trigger">…</button><div class="topbar-overflow-menu">…</div></div> */
.topbar-overflow { position: relative; }
.topbar-overflow-trigger { width: 32px; padding: 0; justify-content: center; font-size: 18px; line-height: 1; }
.topbar-overflow-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; display: none; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: var(--oc-r-card); background: var(--surface-1); box-shadow: var(--oc-shadow-3); }
.topbar-overflow[open] .topbar-overflow-menu { display: grid; gap: 2px; }
.topbar-overflow-menu .tbtn { width: 100%; height: 36px; justify-content: flex-start; padding: 0 10px; }
.topbar-overflow-menu .tbtn:hover { background: var(--surface-2); }

/* 3 · Experience nav merges INTO the topbar (no second bar) */
body[data-experience-shell="1"] #app { height: 100%; margin-top: 0; }
#experienceNav { height: var(--oc-topbar-h); width: auto; right: auto; gap: 8px; padding: 0 8px 0 10px; border: 0; background: transparent; box-shadow: none; z-index: 41; pointer-events: none; color: var(--text-1); }
#experienceNav > * { pointer-events: auto; }
#experienceNav .experience-brand { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 2px; color: var(--text-1); font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
#experienceNav .experience-brand::before { content: ""; width: 20px; height: 20px; border-radius: 6px; background: var(--accent); box-shadow: inset 0 0 0 5px var(--surface-1), inset 0 0 0 6px var(--accent); }
#experienceNav .experience-links a { height: 32px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: var(--oc-r-control); color: var(--text-2); font-size: var(--oc-fs-ui); font-weight: 600; }
#experienceNav .experience-links a:hover, #experienceNav .experience-links a.on { color: var(--accent); background: var(--oc-accent-soft); }
#experienceNav .experience-spacer { display: none; }
#experienceAccessBadge { height: 26px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: var(--oc-r-pill); color: var(--text-2); background: var(--surface-2); font-size: var(--oc-fs-micro); font-weight: 700; }
#experienceAccessBadge::before { width: 7px; height: 7px; background: var(--text-2); }
body[data-onecanvas-access="admin"] #experienceAccessBadge { color: var(--oc-ok-text); border-color: transparent; background: var(--oc-ok-soft); }
body[data-onecanvas-access="admin"] #experienceAccessBadge::before { background: var(--oc-ok); }
body[data-onecanvas-access="viewer"] #experienceAccessBadge { color: var(--accent); border-color: transparent; background: var(--oc-accent-soft); }
body[data-onecanvas-access="viewer"] #experienceAccessBadge::before { background: var(--accent); }
body[data-experience-shell="1"] #topbar { padding-left: 344px; }
body[data-experience-shell="1"] #topbar .logo { display: none; }

/* 4 · Left panel — pages · layers · assets */
#left { background: var(--surface-1); border-right: 1px solid var(--line); }
.tabs { gap: 4px; padding: 10px 10px 0; border-bottom: 1px solid var(--line); }
.tabs button { height: 34px; padding: 0; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; color: var(--text-2); font-size: var(--oc-fs-ui); font-weight: 600; }
.tabs button:hover { color: var(--text-1); background: var(--surface-2); }
.tabs button.on { color: var(--text-1); border-bottom-color: var(--accent); background: transparent; }
.page-section { max-height: min(240px, 40%); padding: 8px 0 8px; }
.panel-section-head { height: 32px; padding: 0 10px 0 12px; color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 700; letter-spacing: .02em; }
.panel-section-head .count { color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 600; opacity: .8; }
.panel-section-head button { width: 24px; height: 24px; border-radius: 6px; font-size: 18px; }
#pageList { padding: 0 8px; }
.page-row { min-height: 32px; gap: 8px; padding: 4px 8px 4px 8px; border-radius: var(--oc-r-control); color: var(--text-2); font-size: var(--oc-fs-ui); }
.page-row:hover { color: var(--text-1); background: var(--surface-2); }
.page-row.active { color: var(--text-1); background: var(--accent-weak); font-weight: 600; }
.page-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); outline: 0; }
.page-row .page-icon { width: 16px; font-size: 13px; }
.page-row .page-count { font-size: var(--oc-fs-micro); font-variant-numeric: tabular-nums; }
.page-row .page-delete { width: 22px; height: 22px; border-radius: 6px; font-size: 14px; }
/* temporary-data indicator: the trial space row */
.trial-space-row { min-height: 44px; margin: 4px 0 6px; padding: 8px; border-radius: var(--oc-r-card); }
.trial-space-row:not(.active) { border-color: var(--oc-warn-line); background: var(--oc-warn-soft); color: var(--oc-warn-text); }
.trial-space-row:not(.active):hover { border-color: var(--oc-warn); background: var(--oc-warn-soft); }
.trial-space-row .page-icon { width: 30px; height: 24px; border-radius: 6px; color: var(--oc-warn-text); background: color-mix(in srgb, var(--oc-warn) 22%, transparent); font-size: 11px; font-weight: 800; }
.trial-space-row:not(.active) .page-count { color: var(--oc-warn-text); font-weight: 700; }
.layer-section-head { height: 32px; padding: 6px 12px 0; color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 700; letter-spacing: .02em; }
#layerSearch { height: 32px; margin: 6px 10px 6px; padding: 0 10px; background: var(--surface-0); }
.layer-tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 0 10px 8px; }
.layer-tools button { height: 28px; padding: 0; border-radius: 6px; font-size: var(--oc-fs-meta); font-weight: 600; }
.layer-tools #btnArrangeSelection { grid-column: 1 / -1; }
.layer-row { min-height: 30px; gap: 6px; padding: 3px 10px 3px 0; font-size: var(--oc-fs-ui); }
.layer-row:hover { background: var(--surface-2); }
.layer-row.sel { background: var(--accent-weak); }
.layer-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); outline: 0; }
.layer-row .glyph { width: 30px; height: 20px; border-radius: 5px; font-size: 10px; font-weight: 700; font-family: var(--oc-mono); letter-spacing: 0; }
.layer-row .mode { height: 18px; padding: 0 6px; border-radius: 4px; font-size: 11px; }
.layer-row .rbtn { font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.wide { margin: 10px; padding: 10px 0; border: 1px dashed var(--oc-line-strong); border-radius: var(--oc-r-control); background: transparent; color: var(--accent); font-weight: 600; }
.wide:hover { border-color: var(--accent); background: var(--accent-weak); }
.asset-card { border-radius: var(--oc-r-control); padding: 8px; }
.asset-card .thumb { border-radius: 6px; }
.asset-card .meta { font-size: var(--oc-fs-meta); }

/* 5 · Stage chrome (canvas engine geometry untouched) */
.workspace-panel-toggle { width: 28px; height: 32px; border-radius: var(--oc-r-control); background: var(--surface-1); box-shadow: var(--oc-shadow-2); }
.workspace-panel-toggle:hover, .workspace-panel-toggle:focus-visible { color: var(--accent); border-color: var(--oc-accent-line); }
.item.sel { box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-weak); }
.item.content-editing { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-weak); }
.k-code, .k-pro, .k-url, .k-youtube, .k-browser, .k-collaboration, .k-screenShare, .k-file, .k-media, .k-database, .k-calendar { border-radius: 10px; box-shadow: var(--oc-shadow-1); }
.card-head { border-radius: 10px 10px 0 0; font-size: var(--oc-fs-micro); }
.card-body { border-radius: 0 0 10px 10px; }
.card-tag { font-size: 11px; letter-spacing: .04em; }
.card-name { color: var(--text-1); }
.card-open { border-radius: 6px; }
.k-frame { border-radius: 12px; }
.frame-label { top: -26px; padding: 0 6px; border-radius: 6px; font-size: var(--oc-fs-micro); font-weight: 650; }
.item[data-entry-mode]:not([data-entry-mode=""]).sel:not(.content-editing)::after, .item.content-editing::after { height: 22px; top: -28px; padding: 0 8px; border-radius: 6px; font-size: 11px; line-height: 22px; }
#minimapBox { right: 12px; bottom: 12px; padding: 4px; border-radius: 10px; box-shadow: var(--oc-shadow-2); }
.comment-pin { width: 28px; height: 28px; font-size: 11px; }
.remote-selection-label { height: 22px; padding: 0 8px; border-radius: 6px 6px 6px 0; font-size: 11px; line-height: 22px; }
.rcursor .tag { padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }
/* Empty canvas guide (markup change C): <div id="stageEmptyGuide" class="stage-empty-guide" hidden> … */
.stage-empty-guide { position: absolute; left: 50%; top: 46%; z-index: 21; width: min(420px, calc(100% - 32px)); transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 10px; padding: 24px; border: 1px dashed var(--oc-line-strong); border-radius: var(--oc-r-panel); color: var(--text-2); text-align: center; pointer-events: none; }
.stage-empty-guide[hidden] { display: none; }
.stage-empty-guide strong { color: var(--text-1); font-size: 16px; font-weight: 650; }
.stage-empty-guide span { font-size: var(--oc-fs-ui); line-height: 1.55; }
.stage-empty-guide kbd { font-size: var(--oc-fs-micro); }

/* 6 · Right inspector — contextual details */
#right { background: var(--surface-1); border-left: 1px solid var(--line); }
#right::before { content: "상세"; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; height: 40px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--surface-1); color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 700; letter-spacing: .02em; }
#inspector { padding: 12px 14px 20px; gap: 10px; }
#inspector:empty::after { content: "카드를 선택하면 상세 정보와 편집 옵션이 표시됩니다."; display: block; margin: 8px 0; padding: 20px 16px; border: 1px dashed var(--oc-line-strong); border-radius: var(--oc-r-card); color: var(--text-2); font-size: var(--oc-fs-ui); line-height: 1.55; text-align: center; }
#inspector h4 { margin-top: 10px; color: var(--text-2); font-size: var(--oc-fs-micro); font-weight: 700; letter-spacing: .02em; }
.fld { gap: 10px; font-size: var(--oc-fs-ui); }
.fld > span { width: 64px; color: var(--text-2); font-size: var(--oc-fs-meta); }
.fld input, .fld select, .fld textarea { height: 32px; padding: 0 10px; background: var(--surface-0); }
.fld textarea { height: auto; padding: 8px 10px; }
.fld input[type="color"] { width: 44px; height: 32px; padding: 3px; }
.btn-primary { height: 36px; padding: 0; border-radius: var(--oc-r-control); color: var(--oc-accent-ink); background: var(--accent); font-size: var(--oc-fs-ui); font-weight: 650; }
.btn-primary:hover { background: var(--oc-accent-strong); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-line { height: 36px; padding: 0; border-radius: var(--oc-r-control); color: var(--text-1); font-size: var(--oc-fs-ui); font-weight: 600; }
.btn-line:hover { background: var(--surface-2); }
.insp-note { font-size: var(--oc-fs-meta); line-height: 1.6; }

/* 7 · Bottom bar — zoom · hints · count */
#bottombar { gap: 0; padding: 0 12px; color: var(--text-2); }
#bottombar .tbtn { height: 26px; padding: 0 8px; font-size: var(--oc-fs-meta); font-weight: 600; }
#zoomOut, #zoomPct, #zoomIn { border: 1px solid var(--line); border-radius: 0; margin-right: -1px; background: var(--surface-1); }
#zoomOut { border-radius: 7px 0 0 7px; width: 30px; padding: 0; justify-content: center; }
#zoomIn { border-radius: 0 7px 7px 0; width: 30px; padding: 0; justify-content: center; margin-right: 0; }
#zoomPct { min-width: 60px; justify-content: center; color: var(--text-1); font-variant-numeric: tabular-nums; }
#zoomOut:hover, #zoomPct:hover, #zoomIn:hover { background: var(--surface-2); position: relative; z-index: 1; }
#zoomFit { margin-left: 8px; }
#bottombar .hint { margin-left: 14px; font-size: var(--oc-fs-micro); color: var(--text-2); opacity: .85; }
#itemCount { font-size: var(--oc-fs-micro); font-variant-numeric: tabular-nums; }

/* 8 · Quick dock — compact tool dock */
#quickDock { bottom: calc(var(--oc-bottombar-h) + 12px); gap: 4px; padding: 6px; border-radius: 14px; background: color-mix(in srgb, var(--surface-1) 96%, transparent); box-shadow: var(--oc-shadow-3); }
.qd-btn { width: 40px; height: 40px; border-radius: 10px; color: var(--text-2); transition: background var(--oc-motion-fast) var(--oc-ease), color var(--oc-motion-fast) var(--oc-ease); }
.qd-btn:hover { color: var(--text-1); background: var(--surface-2); }
.qd-btn.on { color: var(--oc-accent-ink); background: var(--accent); }
.qd-btn.is-disabled { opacity: .45; cursor: not-allowed; }
.qd-icon { font-size: 18px; }
.qd-key { right: 4px; bottom: 3px; font: 600 10px/1 var(--oc-mono); opacity: .7; }
.qd-btn.on .qd-key { opacity: .9; }
.qd-sep { height: 26px; margin: 0 4px; }
.qd-btn.is-feature { min-width: 44px; padding: 0 12px; gap: 8px; }
.qd-btn.is-feature strong { font-size: var(--oc-fs-meta); font-weight: 650; }
.qd-btn.launcher { min-width: 72px; padding: 0 12px 0 10px; gap: 6px; color: var(--accent); border-color: var(--oc-accent-line); background: var(--oc-accent-soft); }
.qd-btn.launcher:hover, .qd-btn.launcher.on { color: var(--accent); border-color: var(--accent); background: var(--oc-accent-soft); }
.qd-btn.launcher strong { font-size: var(--oc-fs-meta); font-weight: 700; }
.qd-badge { min-width: 18px; height: 18px; font-size: 11px; }
#toasts { bottom: calc(var(--oc-bottombar-h) + 72px); }
.toast { padding: 10px 14px; border-radius: 10px; font-size: var(--oc-fs-ui); box-shadow: var(--oc-shadow-2); }
#penOptions { bottom: calc(var(--oc-bottombar-h) + 64px); padding: 8px 10px; border-radius: 12px; box-shadow: var(--oc-shadow-3); }
.pen-option-label { font-size: var(--oc-fs-micro); }
.pen-swatch, .pen-width { width: 28px; height: 28px; border-radius: 7px; }
.pen-mode, .pen-nib-select { height: 30px; font-size: var(--oc-fs-meta); }

/* 9 · Panels, launcher, search, dialogs */
#insertMenu { bottom: calc(var(--oc-bottombar-h) + 78px); border-radius: var(--oc-r-panel); box-shadow: var(--oc-shadow-3); }
.feature-launcher-head { min-height: 60px; padding: 10px 12px 10px 16px; }
.feature-launcher-title strong { font-size: 15px; }
.feature-launcher-title span { font-size: var(--oc-fs-meta); }
#featureSearch { height: 36px; padding: 0 12px; }
.feature-group-head strong { font-size: var(--oc-fs-micro); letter-spacing: .02em; }
.feature-group-head span { font-size: var(--oc-fs-micro); }
.feature-entry { min-height: 64px; gap: 10px; padding: 8px 10px; border-radius: var(--oc-r-card); }
.feature-entry-icon { width: 40px; height: 40px; border-radius: 10px; font-size: 18px; }
.feature-entry-main strong { font-size: var(--oc-fs-ui); }
.feature-entry-main span { font-size: var(--oc-fs-meta); }
.feature-pin { width: 30px; height: 30px; border-radius: 8px; }
#activityPanel { top: calc(var(--oc-topbar-h) + 8px); border-radius: var(--oc-r-panel); box-shadow: var(--oc-shadow-3); }
.activity-head strong { font-size: 15px; }
.activity-head span { font-size: var(--oc-fs-meta); }
.activity-item { gap: 10px; padding: 10px 14px; grid-template-columns: 28px minmax(0, 1fr); }
.activity-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: var(--oc-fs-micro); }
.activity-copy strong { font-size: var(--oc-fs-ui); }
.activity-detail { font-size: var(--oc-fs-meta); }
.activity-meta { font-size: var(--oc-fs-micro); }
#chatPanel { bottom: calc(var(--oc-bottombar-h) + 64px); border-radius: var(--oc-r-panel); box-shadow: var(--oc-shadow-3); }
.chat-head strong { font-size: 15px; }
.chat-head .chat-mode { font-size: var(--oc-fs-micro); }
.chat-msg { grid-template-columns: 28px 1fr; gap: 8px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 8px; font-size: var(--oc-fs-micro); }
.chat-meta strong { font-size: var(--oc-fs-meta); }
.chat-meta time { font-size: var(--oc-fs-micro); }
.chat-text { font-size: var(--oc-fs-ui); }
#chatInput { font-size: var(--oc-fs-ui); padding: 8px 10px; }
.modal-card { padding: 24px; border-radius: var(--oc-r-panel); box-shadow: var(--oc-shadow-3); }
.modal-card h2 { font-size: var(--oc-fs-h3); }
.modal-card .sub { font-size: var(--oc-fs-ui); }
.modal-card h3 { font-size: var(--oc-fs-meta); }
.modal-card table { font-size: var(--oc-fs-ui); }
.drive-actions button { min-height: 40px; border-radius: var(--oc-r-control); }
kbd { padding: 1px 6px; border-radius: 5px; font: 600 12px var(--oc-mono); }
#globalSearch { top: calc(var(--oc-topbar-h) + 24px); border-color: var(--line); border-radius: var(--oc-r-panel); color: var(--text-1); background: var(--surface-1); box-shadow: var(--oc-shadow-3); }
.global-search-head { padding: 12px 14px; border-bottom-color: var(--line); }
.global-search-input-wrap::before { color: var(--text-2); }
#globalSearchInput { color: var(--text-1); font-size: 16px; }
#globalSearchClose { color: var(--text-2); }
#globalSearchClose:hover { color: var(--text-1); background: var(--surface-2); }
.global-search-summary { color: var(--text-2); font-size: var(--oc-fs-meta); }
.global-search-empty { color: var(--text-2); font-size: var(--oc-fs-ui); }
.global-search-result { border-radius: var(--oc-r-card); }
.global-search-result:hover, .global-search-result:focus-visible { border-color: var(--oc-accent-line); background: var(--accent-weak); }
.global-search-result-head strong { color: var(--text-1); font-size: var(--oc-fs-ui); }
.global-search-result-head span { color: var(--accent); font-size: var(--oc-fs-micro); }
.global-search-result p { color: var(--text-2); font-size: var(--oc-fs-meta); }
#focusTop { height: var(--oc-topbar-h); }
#focusTop .kind { font-size: var(--oc-fs-micro); border-radius: 6px; padding: 3px 8px; }

/* 10 · Showcase coach, experience prompt, tasks — compact, themed, no perpetual motion */
#showcaseReplay { top: 12px; right: 12px; width: min(320px, calc(100% - 24px)); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--oc-r-card); color: var(--text-1); background: color-mix(in srgb, var(--surface-1) 96%, transparent); box-shadow: var(--oc-shadow-2); }
.showcase-replay-head strong { font-size: var(--oc-fs-ui); }
#showcaseReplayPage { color: var(--accent); font-size: var(--oc-fs-micro); }
#showcaseReplayStatus { min-height: 0; margin: 6px 0 10px; color: var(--text-2); font-size: var(--oc-fs-meta); }
.showcase-start-guide { gap: 10px; margin: 0 0 10px; padding: 10px; border: 1px solid var(--oc-accent-line); border-radius: 10px; background: var(--accent-weak); }
.showcase-start-guide-copy strong { color: var(--text-1); font-size: var(--oc-fs-meta); }
.showcase-start-guide-copy em { color: var(--text-2); font-size: var(--oc-fs-micro); }
.showcase-start-guide-copy span { color: var(--accent); font-size: var(--oc-fs-micro); }
.showcase-start-guide button, #showcaseExperienceDirect { min-height: 34px; padding: 0 12px; border-color: var(--accent); border-radius: var(--oc-r-control); color: var(--oc-accent-ink); background: var(--accent); font-size: var(--oc-fs-meta); }
.showcase-start-guide.guide-attention { animation: none; }
.showcase-replay-actions button { min-height: 32px; border-color: var(--line); border-radius: var(--oc-r-control); color: var(--text-1); background: var(--surface-2); font-size: var(--oc-fs-meta); }
.showcase-replay-actions button:hover { border-color: var(--oc-line-strong); background: var(--surface-3); }
#showcaseReplayExperience button, #showcaseReplayReturning button { color: var(--oc-accent-ink); border-color: var(--accent); background: var(--accent); }
#showcaseReplay.showcase-finale { border-color: var(--oc-accent-line); box-shadow: var(--oc-shadow-3); }
#showcaseReplay.showcase-finale #showcaseReplayExperience { transform: none; animation: none; }
#showcaseReplay.showcase-finale #showcaseReplayExperience button { box-shadow: 0 0 0 4px var(--accent-weak); }
#showcaseExperiencePrompt { background: var(--oc-overlay); }
.showcase-experience-card { width: min(640px, calc(100vw - 32px)); padding: 28px; border: 1px solid var(--line); border-radius: 18px; color: var(--text-1); background: var(--surface-1); box-shadow: var(--oc-shadow-3); }
.showcase-experience-card::before { display: none; }
.showcase-experience-kicker { margin-bottom: 8px; color: var(--accent); font-size: var(--oc-fs-micro); letter-spacing: .06em; }
.showcase-experience-card h2 { font-size: 24px; line-height: 1.25; letter-spacing: -.02em; }
.showcase-experience-card > p { margin: 10px 0 20px; color: var(--text-2); font-size: var(--oc-fs-ui); line-height: 1.6; }
.showcase-purpose-card { min-height: 84px; gap: 12px; padding: 14px; border-color: var(--line); border-radius: var(--oc-r-card); color: var(--text-1); background: var(--surface-2); }
.showcase-purpose-form[data-showcase-purpose="blank"] .showcase-purpose-card { min-height: 64px; background: transparent; border-color: var(--oc-line-strong); }
.showcase-purpose-card:hover, .showcase-purpose-card:focus-visible { border-color: var(--accent); background: var(--surface-1); box-shadow: var(--oc-focus-ring); transform: none; }
.showcase-purpose-number { width: 34px; height: 34px; border-radius: 8px; color: var(--accent); background: var(--accent-weak); font-size: var(--oc-fs-micro); }
.showcase-purpose-copy strong { font-size: 15px; }
.showcase-purpose-copy span { color: var(--text-2); font-size: var(--oc-fs-meta); }
.showcase-purpose-arrow { color: var(--accent); }
.showcase-experience-actions button { min-height: 40px; border-color: var(--line); border-radius: var(--oc-r-control); color: var(--text-1); background: var(--surface-2); font-size: var(--oc-fs-ui); }
#experienceTasks { top: 12px; right: 12px; width: min(340px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: var(--oc-r-panel); color: var(--text-1); background: color-mix(in srgb, var(--surface-1) 97%, transparent); box-shadow: var(--oc-shadow-2); }
.experience-task-kicker { color: var(--accent); font-size: var(--oc-fs-micro); letter-spacing: .06em; }
.experience-task-head h2 { font-size: 16px; }
#experienceTasksToggle { border-color: var(--line); color: var(--text-2); background: var(--surface-2); }
.experience-task-progress-copy { color: var(--text-2); font-size: var(--oc-fs-micro); }
.experience-task-progress { background: var(--surface-3); }
.experience-task-progress > span { background: var(--accent); }
.experience-task-button { border-color: var(--line); border-radius: var(--oc-r-card); color: var(--text-1); background: var(--surface-2); }
.experience-task-button:hover, .experience-task-button:focus-visible { border-color: var(--accent); background: var(--surface-1); }
.experience-task-button[data-done="true"] { border-color: var(--oc-ok); background: var(--oc-ok-soft); }
.experience-task-check { color: var(--accent); background: var(--accent-weak); font-size: var(--oc-fs-micro); }
.experience-task-copy strong { font-size: var(--oc-fs-ui); }
.experience-task-copy small { color: var(--text-2); font-size: var(--oc-fs-meta); }
.experience-task-finish { color: var(--text-2); font-size: var(--oc-fs-meta); }
.experience-task-fields label { color: var(--text-2); font-size: var(--oc-fs-meta); }
.experience-task-fields input, .experience-task-fields textarea { border-color: var(--line); background: var(--surface-0); color: var(--text-1); font-size: var(--oc-fs-ui); }
.experience-task-fields button { border-radius: var(--oc-r-control); background: var(--accent); }
#playgroundFollowupLauncher { bottom: calc(var(--oc-bottombar-h) + 64px); min-height: 40px; font-size: var(--oc-fs-meta); }

/* 11 · Read-only (viewer) mode — themed, indicator kept readable */
body[data-onecanvas-access="viewer"] #left { border-right-color: var(--line); background: var(--surface-1); }
body[data-onecanvas-access="viewer"] #topbar { background: var(--surface-1); border-bottom-color: var(--line); }
body[data-onecanvas-access="viewer"] #bottombar { background: var(--surface-1); border-top-color: var(--line); }
body[data-onecanvas-access="viewer"] .panel-section-head { height: 36px; color: var(--text-2); font-size: var(--oc-fs-micro); }
body[data-onecanvas-access="viewer"] .page-row { min-height: 40px; margin-bottom: 2px; padding: 8px 10px; color: var(--text-2); border-radius: var(--oc-r-control); font-size: var(--oc-fs-ui); }
body[data-onecanvas-access="viewer"] .page-row.active { color: var(--accent); border-color: transparent; background: var(--accent-weak); }
body[data-onecanvas-access="viewer"] #topbar::after { display: inline-flex; align-items: center; gap: 6px; height: 26px; margin-left: 8px; padding: 0 10px; border-radius: var(--oc-r-pill); color: var(--accent); background: var(--accent-weak); font-size: var(--oc-fs-micro); font-weight: 600; white-space: nowrap; }

/* 12 · Compact desktop (≤ 1200px): same hierarchy, denser chrome */
@media (max-width: 1200px) {
  :root { --leftw: 248px; --rightw: 264px; }
  .doc-title { width: clamp(140px, 18vw, 240px); }
  .global-search-trigger { min-width: 0; width: 32px; padding: 0; justify-content: center; font-size: 0; }
  .global-search-trigger::before { font-size: 17px; }
  #btnActivity { font-size: 0; }
  #btnActivity .activity-count { margin-left: 0; font-size: var(--oc-fs-micro); }
  #btnActivity::before { content: "≡"; color: var(--text-2); font-size: 16px; }
  #bottombar .hint { display: none; }
  body[data-experience-shell="1"] #topbar { padding-left: 300px; }
}

/* 13 · Small screens (≤ 900px): drawers + touch targets; desktop controls stay reachable in drawers */
@media (max-width: 900px) {
  :root { --oc-bottombar-h: 44px; }
  #topbar { gap: 6px; padding: 0 8px; }
  .mobile-panel-toggle { height: 36px; padding: 0 12px; border-radius: var(--oc-r-control); font-size: var(--oc-fs-ui); }
  #topbar .doc-title { height: 36px; }
  #topbar .save-status { top: calc(var(--oc-topbar-h) + 8px); left: 8px; height: 28px; background: var(--surface-1); box-shadow: var(--oc-shadow-2); }
  #app #left, #app #right { top: var(--oc-topbar-h); bottom: var(--oc-bottombar-h); width: min(88vw, 340px); box-shadow: var(--oc-shadow-3); }
  #mobilePanelBackdrop { inset: var(--oc-topbar-h) 0 var(--oc-bottombar-h); background: var(--oc-overlay); }
  #bottombar .tbtn { height: 32px; }
  #zoomOut, #zoomIn { width: 36px; }
  #quickDock { left: 8px; right: 8px; bottom: calc(var(--oc-bottombar-h) + 8px); justify-content: flex-start; }
  .qd-btn { width: 44px; height: 44px; }
  .qd-btn.launcher { width: 44px; min-width: 44px; }
  #insertMenu { bottom: calc(var(--oc-bottombar-h) + 66px); }
  #chatPanel, #voiceRoomBar { bottom: calc(var(--oc-bottombar-h) + 66px); }
  #experienceNav { height: 36px; right: 0; width: 100vw; padding: 0 10px; background: var(--surface-1); border-bottom: 1px solid var(--line); pointer-events: auto; }
  #experienceNav .experience-brand { height: 28px; font-size: 14px; }
  #experienceNav .experience-brand::before { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 4px var(--surface-1), inset 0 0 0 5px var(--accent); }
  #experienceNav .experience-spacer { display: block; flex: 1; }
  body[data-experience-shell="1"] #app { height: calc(100% - 36px); margin-top: 36px; }
  body[data-experience-shell="1"] #topbar { padding-left: 8px; }
  body[data-experience-shell="1"] #app #left, body[data-experience-shell="1"] #app #right { top: calc(var(--oc-topbar-h) + 36px); }
  body[data-onecanvas-access="viewer"] #topbar::after { display: none; }
  #showcaseReplay { top: 8px; right: 8px; width: min(300px, calc(100% - 16px)); }
  #experienceTasks { top: auto; right: 8px; bottom: calc(var(--oc-bottombar-h) + 66px); width: calc(100% - 16px); }
}

/* 14 · Motion respect */
@media (prefers-reduced-motion: reduce) {
  #quickDock, #insertMenu.open, #globalSearch.open, .toast, .tbtn, .qd-btn, #app #left, #app #right { animation: none; transition: none; }
}

/* Native details keeps overflow actions keyboard accessible and state truthful. */
.topbar-overflow-trigger { list-style: none; cursor: pointer; display: flex; }
.topbar-overflow-trigger::-webkit-details-marker { display: none; }
@media (min-width: 901px) {
  #topbar .doc-title { min-width: 140px; }
  #topbar .topbar-overflow { flex: none; }
}
body[data-onecanvas-access="viewer"] #topbar::after { display: none; }
@media (max-width: 900px) {
  #topbar { overflow: visible; z-index: 49; }
  body[data-experience-shell="1"] #topbar .save-status { top: calc(var(--oc-topbar-h) + 44px); }
  #topbar .topbar-overflow-menu #btnHelp { display: inline-flex; }
  body:not([data-onecanvas-access="viewer"]) #topbar .topbar-overflow-menu :is(#btnLiveBrowser, #btnDrive, #btnImport, #btnExport, #btnTheme) { display: inline-flex; }
}
