/* scenario.younghee.love */

:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --line: #e7e7e2;
  --line-2: #d8d8d2;
  --text: #1d1d1f;
  --sub: #66665f;
  --faint: #9a9a93;
  --accent: #2e6be6;
  --accent-soft: #eaf0fd;
  --hover: #f2f2ef;
  --press: #e8e8e4;
  --danger: #cf3a3a;
  --warn: #a96b12;
  --ok: #2f8a57;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", "Segoe UI", system-ui, sans-serif;
  --shadow-1: 0 1px 2px rgba(20, 20, 18, 0.06), 0 2px 10px rgba(20, 20, 18, 0.05);
  --shadow-2: 0 10px 34px rgba(20, 20, 18, 0.16), 0 2px 8px rgba(20, 20, 18, 0.07);
  --top-h: 52px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-text-size-adjust: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--sub); }
.small { font-size: 12.5px; }
.pad { padding: 12px; }
.placeholder { color: var(--faint) !important; }
.error-text { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }

/* tag colours (same as the chart) */
.c-rose { --c: #e5484d; }
.c-orange { --c: #ef6c1a; }
.c-amber { --c: #d99a06; }
.c-green { --c: #2f9e65; }
.c-teal { --c: #139f91; }
.c-blue { --c: #1f7ae0; }
.c-indigo { --c: #4560d6; }
.c-violet { --c: #8a4fc4; }
.c-pink { --c: #d3409b; }
.c-gray { --c: #7c7f8a; }
.dot { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c, #9a9a93); }

/* icons */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.i.shape { stroke-width: 1.6; }

/* ---- login ------------------------------------------------------------------------------------- */

.login-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login { width: min(340px, 100%); text-align: center; }
.login-mark { width: 52px; height: 52px; fill: none; stroke: var(--text); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.login-mark rect:first-child { fill: var(--text); }
.login h1 { font-size: 22px; font-weight: 700; margin: 14px 0 4px; letter-spacing: -0.01em; }
.login-sub { color: var(--sub); font-size: 14px; margin: 0 0 26px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.login input { height: 48px; font-size: 16px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; outline: none; }
.login input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 107, 230, 0.15); }
.login button { height: 48px; border-radius: 12px; background: var(--text); color: #fff; font-weight: 600; font-size: 15px; }
.login button:hover { background: #3a3a3f; }
.login-error { color: var(--danger); font-size: 14px; margin: 16px 0 0; }

/* ---- app frame ---------------------------------------------------------------------------------- */

body.app { overflow: hidden; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overscroll-behavior: none; }
body.app:not(.ready) .workspace, body.app:not(.ready) .bottombar { visibility: hidden; }

.topbar {
  flex: none; position: relative; z-index: 6;
  display: flex; align-items: center; gap: 8px;
  min-height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.doc { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; max-width: min(46vw, 520px); padding: 5px 10px; border-radius: 9px; text-align: left; }
.doc:hover { background: var(--hover); }
.doc-title { max-width: 100%; font-size: 15px; font-weight: 650; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-save { font-size: 11.5px; line-height: 1.3; color: var(--faint); white-space: nowrap; }
.doc-save.s-offline, .doc-save.s-error, .doc-save.s-conflict, .doc-save.s-login { color: var(--danger); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }

.ib { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 9px; color: var(--sub); }
.ib:hover { background: var(--hover); color: var(--text); }
.ib:disabled { opacity: 0.32; background: none; color: var(--sub); }
.ib.sm { width: 28px; height: 28px; border-radius: 7px; }
.ib.sm .i { width: 15px; height: 15px; }
.tb { height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 9px; border-radius: 9px; font-size: 13.5px; font-weight: 550; color: var(--text); }
.tb .i { width: 18px; height: 18px; color: var(--sub); }
.tb:hover { background: var(--hover); }
.tb[aria-pressed="true"] { background: var(--press); }
.tb.primary { background: var(--text); color: #fff; margin-left: 4px; }
.tb.primary .i { color: #fff; }
.tb.primary:hover { background: #3a3a3f; }

.btn { height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); font-size: 13.5px; font-weight: 550; white-space: nowrap; text-decoration: none; color: var(--text); }
.btn:hover { background: var(--hover); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--text); border-color: var(--text); color: #fff; }
.btn.primary:hover { background: #3a3a3f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--sub); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.ghost.danger { color: var(--danger); background: none; }
.btn.ghost.danger:hover { background: #fbeeee; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; color: var(--accent); }
.link-btn .i { width: 14px; height: 14px; }

.workspace { flex: 1; min-height: 0; display: flex; position: relative; }
.board { flex: 1; min-width: 0; position: relative; overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.dot-fill { fill: #d3d3cc; }

/* ---- chart -------------------------------------------------------------------------------------- */

#canvas text { font-family: var(--font); pointer-events: none; }
.node { cursor: grab; }
body.dragging, body.dragging .node, body.dragging #canvas { cursor: grabbing; }
body.grab #canvas, body.grab .node { cursor: grab; }
.node .ring { stroke: var(--accent); stroke-width: 2; opacity: 0; pointer-events: none; }
.node.sel .ring, .node.linking .ring { opacity: 1; }
.node.drop .ring { opacity: 1; stroke-dasharray: 5 4; }
.node .port { opacity: 0; cursor: crosshair; transition: opacity 0.12s; pointer-events: none; }
.node.hover .port, .node.sel .port { opacity: 1; pointer-events: auto; }
.node.linking .port { opacity: 0; pointer-events: none; }
.port-hit { fill: transparent; }
.port-dot { fill: #fff; stroke: var(--accent); stroke-width: 1.6; }
.port-plus { stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; fill: none; }
.port:hover .port-dot { fill: var(--accent); }
.port:hover .port-plus { stroke: #fff; }
.t-note .port-dot, .t-note .port-plus { stroke: #b19a3b; }
.edge { cursor: pointer; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 16; }
.edge.near .edge-line { stroke: #6f6f68; }
.edge.near .edge-arrow { fill: #6f6f68; }
.edge.sel .edge-line { stroke: var(--accent); stroke-width: 2.2; }
.edge.sel .edge-arrow { fill: var(--accent); }
.edge.sel .edge-label-bg { stroke: var(--accent); }
.edge:hover .edge-line { stroke-width: 2.2; }
.guide { stroke: #e5484d; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.link-preview { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; pointer-events: none; }
.marquee { fill: rgba(46, 107, 230, 0.07); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }

/* ---- floating tools on the board --------------------------------------------------------------- */

.palette {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); z-index: 3;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-1);
}
.palette button { width: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px 6px; border-radius: 9px; font-size: 11.5px; color: var(--sub); touch-action: none; }
.palette button:hover { background: var(--hover); color: var(--text); }
.palette .shape { width: 26px; height: 26px; }
.drag-ghost { position: fixed; z-index: 60; pointer-events: none; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-2); font-size: 13px; }
.drag-ghost .i { width: 18px; height: 18px; }

.zoombar { position: absolute; left: 14px; bottom: 14px; z-index: 3; display: flex; align-items: center; gap: 1px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.zoombar .ib { width: 32px; height: 32px; }
.zoombar .i { width: 18px; height: 18px; }
.zoom-label { min-width: 48px; height: 32px; border-radius: 8px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--sub); }
.zoom-label:hover { background: var(--hover); color: var(--text); }

.banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--accent); color: #fff; border-radius: 999px; box-shadow: var(--shadow-2); font-size: 13.5px; font-weight: 550; white-space: nowrap; }
.banner button { height: 28px; padding: 0 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); color: #fff; font-size: 12.5px; }
.banner[hidden] { display: none; }
.drop-hint { display: none; position: absolute; inset: 12px; z-index: 5; place-items: center; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(46, 107, 230, 0.06); color: var(--accent); font-weight: 600; pointer-events: none; }
body.dropping .drop-hint { display: grid; }

/* ---- side panels -------------------------------------------------------------------------------- */

.inspector { width: 340px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); }
.inspector-body { flex: 1; overflow-y: auto; padding: 18px 18px 32px; overscroll-behavior: contain; }
.sheet-head { display: none; }
.outline { width: 282px; flex: none; display: none; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
body.outline-open .outline { display: flex; }
.outline-search { padding: 12px 12px 6px; }
.outline-body { flex: 1; overflow-y: auto; padding: 4px 6px 24px; overscroll-behavior: contain; }

.in { width: 100%; padding: 8px 10px; font-size: 14px; line-height: 1.5; color: var(--text); background: #fafaf8; border: 1px solid var(--line-2); border-radius: 9px; outline: none; transition: border-color 0.12s, background 0.12s, box-shadow 0.12s; }
.in:hover { border-color: #c9c9c2; }
.in:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 107, 230, 0.13); }
.in::placeholder { color: #aaaaa3; }
textarea.in { resize: none; line-height: 1.65; min-height: 40px; display: block; }
.in.title-in { font-size: 15.5px; font-weight: 650; }
.in.sm { padding: 6px 9px; font-size: 13px; border-radius: 8px; }

.insp { display: flex; flex-direction: column; gap: 18px; }
.insp-head { display: flex; flex-direction: column; gap: 1px; }
.insp-kicker { font-size: 12.5px; font-weight: 650; color: var(--text); }
.insp-hint { font-size: 12px; color: var(--faint); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: -8px; }
.seg-b { height: 34px; display: flex; align-items: center; gap: 6px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); font-size: 12.5px; color: var(--sub); }
.seg-b:hover { background: var(--hover); color: var(--text); }
.seg-b .shape { width: 18px; height: 18px; }
.seg-b.on { border-color: var(--text); background: #fff; color: var(--text); box-shadow: inset 0 0 0 0.5px var(--text); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 650; color: var(--sub); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font-size: 12.5px; color: var(--sub); }
.chip:hover { color: var(--text); border-color: #c4c4bd; }
.chip.on { border-color: var(--text); color: var(--text); box-shadow: inset 0 0 0 0.5px var(--text); font-weight: 600; }
.chip.add { border-style: dashed; padding-left: 8px; }
.chip .i { width: 14px; height: 14px; }
.links { gap: 6px; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) auto; align-items: center; gap: 6px; }
.links:not(:has(.in)) .link-row, .link-row:not(:has(.in)) { grid-template-columns: minmax(0, 1fr) auto; }
.goto { min-width: 0; height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 8px; background: var(--hover); font-size: 12.5px; text-align: left; }
.goto:hover { background: var(--press); }
.goto span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goto .i { width: 14px; height: 14px; color: var(--faint); }
.links.prev .goto { background: none; border: 1px solid var(--line); }
.links.prev .goto:hover { background: var(--hover); }
.link-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.insp-foot { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.edge-ends { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; margin-top: -6px; }
.arrow-i { width: 16px; height: 16px; color: var(--faint); }

.overview { gap: 20px; }
.ov-title { display: flex; flex-direction: column; gap: 6px; margin: -10px; padding: 10px; border-radius: 12px; text-align: left; }
.ov-title:hover { background: var(--hover); }
.ov-t { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; }
.ov-log { font-size: 13.5px; line-height: 1.6; color: var(--sub); white-space: pre-wrap; }
.ov-stats { margin: -8px 0 0; font-size: 12.5px; color: var(--sub); }
.warn-box summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 650; color: var(--warn); }
.warn-box summary::-webkit-details-marker { display: none; }
.warn-box summary .i { width: 16px; height: 16px; }
.warns { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.warns button, .warns span { display: block; width: 100%; padding: 6px 8px; border-radius: 7px; font-size: 12.5px; line-height: 1.45; text-align: left; }
.warns button:hover { background: var(--hover); }
.ok-line { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; color: var(--ok); }
.ok-line .i { width: 16px; height: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend-i { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.legend-i small { color: var(--faint); }
.tips ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--sub); }
.tips b { font-weight: 600; color: var(--text); }

/* outline */
.o-row { --d: 0; width: 100%; min-height: 32px; display: grid; grid-template-columns: 24px 18px minmax(0, 1fr) auto; align-items: center; column-gap: 7px; padding: 4px 8px 4px calc(6px + var(--d) * 16px); border-radius: 8px; font-size: 13px; text-align: left; }
.o-row:hover { background: var(--hover); }
.o-row.on { background: var(--accent-soft); }
.o-num { font-size: 11.5px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.o-row .shape { width: 16px; height: 16px; color: var(--sub); }
.o-row.t-start .shape { color: var(--text); }
.o-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-row.t-ending .o-title { font-weight: 650; }
.o-sub { grid-column: 3 / -1; font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-branch { --d: 0; padding: 7px 8px 2px calc(37px + var(--d) * 16px - 16px); font-size: 11.5px; font-weight: 650; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-branch::before { content: "↳ "; color: var(--faint); font-weight: 400; }
.o-jump { --d: 0; width: 100%; display: flex; align-items: center; gap: 6px; padding: 3px 8px 5px calc(37px + var(--d) * 16px); font-size: 12px; color: var(--sub); text-align: left; border-radius: 8px; }
.o-jump:hover { color: var(--accent); }
.o-jump .i { width: 13px; height: 13px; }
.o-jump span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o-gap { height: 12px; }
.o-head { padding: 16px 10px 4px; font-size: 11.5px; font-weight: 650; color: var(--faint); }

/* ---- menu, toast, dialogs ----------------------------------------------------------------------- */

.menu { position: fixed; z-index: 40; min-width: 210px; max-width: min(320px, calc(100vw - 16px)); padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); }
.menu[hidden] { display: none; }
.menu-item { width: 100%; display: grid; grid-template-columns: 20px 1fr; align-items: center; column-gap: 10px; padding: 8px 10px; border-radius: 8px; text-align: left; font-size: 13.5px; }
.menu-item .i { width: 18px; height: 18px; color: var(--sub); }
.menu-item small { grid-column: 2; font-size: 11.5px; color: var(--faint); line-height: 1.35; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.danger { color: var(--danger); }
.menu-item > .dot { margin-left: 5px; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-head { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 650; color: var(--faint); }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100vw - 24px)); padding: 10px 12px 10px 16px; background: #2b2b30; color: #fff; border-radius: 12px; box-shadow: var(--shadow-2); font-size: 13.5px; line-height: 1.45; transition: opacity 0.18s, transform 0.18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast.error { background: #8f2525; }
.toast button { flex: none; height: 28px; padding: 0 10px; border-radius: 7px; color: #9cc0ff; font-weight: 600; font-size: 13px; }
.toast button:hover { background: rgba(255, 255, 255, 0.1); }

.dlg { width: min(440px, calc(100vw - 32px)); max-height: min(86vh, 780px); padding: 0; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow-2); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg::backdrop { background: rgba(24, 24, 22, 0.34); }
.dlg.wide { width: min(640px, calc(100vw - 32px)); }
.dlg.full { width: min(860px, calc(100vw - 32px)); height: min(92vh, 980px); max-height: none; }
.dlg-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px 20px; }
.dlg-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 16px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 20px 18px; overscroll-behavior: contain; }
.dlg-foot { flex: none; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 12px 16px 16px; }
.dlg-text { margin: 0 0 8px; font-size: 14px; line-height: 1.65; }
.dlg .stack { display: flex; flex-direction: column; gap: 10px; }

.info { display: flex; flex-direction: column; gap: 18px; }
.cast { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.cast-row { width: 100%; display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 6px; align-items: start; }
.cast-row textarea.in { min-height: 34px; }
.tag-edit { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.tag-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.palette-row { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 6px 2px; }
.palette-row[hidden] { display: none; }
.swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.swatch.on, .swatch[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--text); }

.pick { display: flex; flex-direction: column; gap: 10px; }
.pick-list { max-height: 52vh; overflow-y: auto; margin: 0 -6px; }
.pick-list .o-row small { font-size: 11.5px; }

.hist-list { list-style: none; margin: 10px 0 0; padding: 0; }
.hist-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.hist-main { flex: 1; min-width: 0; font-size: 13.5px; }
.hist-sub { font-size: 12.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-act { display: flex; gap: 6px; }

.dlg.full .dlg-body { display: flex; flex-direction: column; }
.writer { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 680px; margin: 0 auto; }
.w-title { width: 100%; padding: 6px 0 10px; border: 0; border-bottom: 1px solid var(--line); background: none; outline: none; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.w-body { flex: 1; min-height: 260px; width: 100%; padding: 8px 0; border: 0; background: none; outline: none; resize: none; font-size: 16.5px; line-height: 1.85; }
.w-memo { width: 100%; padding: 8px 10px; border: 1px solid #ecdfa6; border-radius: 9px; background: #fdf9e8; outline: none; resize: vertical; font-size: 13.5px; line-height: 1.6; }
.w-memo:focus { border-color: #d9c46f; }
.w-count { align-self: flex-end; }

/* ---- tablet: the outline floats over the board ---------------------------------------------------- */

@media (min-width: 761px) and (max-width: 1100px) {
  .inspector { width: 300px; }
  body.outline-open .outline { position: absolute; left: 0; top: 0; bottom: 0; z-index: 5; width: 272px; box-shadow: var(--shadow-2); }
}

/* ---- phone -------------------------------------------------------------------------------------- */

.bottombar { display: none; }

@media (max-width: 760px) {
  :root { --top-h: 54px; }
  .wide-only { display: none !important; }
  .palette, .zoombar { display: none; }
  .doc { max-width: none; flex: 1; }
  .top-tools { margin-left: 0; }
  .in, .in.sm, textarea.in { font-size: 16px; }

  .inspector, .outline {
    position: fixed; inset: 0; z-index: 30; width: auto; display: flex;
    border: 0; visibility: hidden; transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s 0.24s;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .inspector { transform: translateY(100%); }
  .outline { transform: translateX(-100%); }
  body.sheet-inspector .inspector, body.sheet-outline .outline { transform: none; visibility: visible; transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .sheet-head { flex: none; display: flex; align-items: center; gap: 6px; min-height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0 6px; border-bottom: 1px solid var(--line); }
  .sheet-head b { min-width: 0; font-size: 15.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inspector-body { padding: 16px 16px 40px; }
  .seg { grid-template-columns: repeat(3, 1fr); }
  .seg-b { height: 40px; }
  .goto { height: 38px; }
  .chip { height: 34px; }
  .link-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }

  .bottombar {
    flex: none; display: flex; z-index: 6;
    min-height: calc(58px + env(safe-area-inset-bottom)); padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    background: var(--panel); border-top: 1px solid var(--line);
  }
  .bb { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--sub); }
  .bb .i { width: 23px; height: 23px; }
  .bb:active { background: var(--hover); }
  .bb.accent { color: var(--accent); }
  .bb.danger { color: var(--danger); }
  .toast { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .banner { top: 10px; }

  .dlg.wide, .dlg.full { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .dlg.wide .dlg-head, .dlg.full .dlg-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .dlg.wide .dlg-foot, .dlg.full .dlg-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .cast-row { grid-template-columns: 1fr auto; }
  .cast-row textarea { grid-column: 1 / 2; }
  .cast-row .ib { grid-row: 1; grid-column: 2; }
  .hist-list li { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
