:root{
  --spring:linear(0, .18 6%, .52 14%, .82 24%, .97 34%, 1.025 46%, 1.03 54%, 1.012 70%, 1.002 85%, 1); /* 2팀 움직임 규칙: 살짝 튀는 용수철(넘침 3%), 서랍·아래 창 전용 */
  --bg:#FBFAF7; --surface:#F1F0EC; --surface2:#E7E6E1; --line:#E8E6E1; --text:#1C1C1A; --muted:#6F6E69; --faint:#BDBBB5;
  --ink:#1C1C1A; --onink:#FFFFFF; --sheet:#FBFAF7; --danger:#E5484D; --link:#2F6FDB; --mark:#FFE58F;
  --banner:#FFF4D6; --banner-t:#6B4E00; --toast-act:#7FA8F5;
  --shadow:0 10px 30px rgba(0,0,0,.10);
  --rel-family:#2B3A55; --rel-love:#E6336F; --rel-conflict:#8B3FD1; --rel-friend:#2FA9DE; --rel-etc:#9A9A95;
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ --rel-family:#A9BBDD; --rel-conflict:#B88AF0; } }
:root[data-theme="dark"]{ --rel-family:#A9BBDD; --rel-conflict:#B88AF0; }
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#151514; --surface:#222220; --surface2:#2D2D2A; --line:#2E2E2B; --text:#EDEDE9; --muted:#9A9993; --faint:#5F5E5A;
    --ink:#EDEDE9; --onink:#151514; --sheet:#1C1C1B; --link:#7FA8F5; --mark:#7A6420;
    --banner:#3A3220; --banner-t:#F2D98B; --toast-act:#2F6FDB; --shadow:0 10px 30px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"]{
  --bg:#151514; --surface:#222220; --surface2:#2D2D2A; --line:#2E2E2B; --text:#EDEDE9; --muted:#9A9993; --faint:#5F5E5A;
  --ink:#EDEDE9; --onink:#151514; --sheet:#1C1C1B; --link:#7FA8F5; --mark:#7A6420;
  --banner:#3A3220; --banner-t:#F2D98B; --toast-act:#2F6FDB; --shadow:0 10px 30px rgba(0,0,0,.5);
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
[hidden]{display:none!important}
html,body{margin:0;height:100%;overflow-x:hidden;background:var(--bg);color:var(--text);
  font-family:'Pretendard',-apple-system,BlinkMacSystemFont,'Apple SD Gothic Neo',sans-serif;
  -webkit-font-smoothing:antialiased;touch-action:manipulation;-webkit-text-size-adjust:100%}
body{position:fixed;inset:0;overflow:hidden;overscroll-behavior:none}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
input,textarea{font:inherit;color:inherit}
svg.i{width:22px;height:22px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none;display:block}
svg.i.sm{width:16px;height:16px}
.grow{flex:1}
.muted{color:var(--muted)}

.screen{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);display:flex;flex-direction:column;background:var(--bg)}
.topbar{display:flex;align-items:center;gap:10px;padding:calc(env(safe-area-inset-top) + 10px) 16px 10px;flex:none}
.top-title{flex:1;text-align:center;font-size:calc(17px * var(--uk,1));font-weight:600}
.cbtn{width:46px;height:46px;border-radius:50%;border:1px solid var(--line);display:grid;place-items:center;background:var(--bg);flex:none}
.cbtn:active{background:var(--surface)}
.cbtn.ghost{border-color:transparent;pointer-events:none}
.scroll{flex:1;min-height:0;overflow-y:auto;padding:0 16px calc(130px + env(safe-area-inset-bottom));overscroll-behavior:contain}


.bigtabs{display:flex;gap:18px;margin:6px 4px 18px}
.bigtabs button{font-size:28px;font-weight:700;letter-spacing:-.02em;color:var(--muted)}
.bigtabs button.on{color:var(--text)}
.tag{display:inline-block;font-size:calc(11px * var(--uk,1));font-weight:600;color:var(--muted);background:var(--surface);border-radius:6px;padding:2px 6px;margin-right:6px;vertical-align:2px}

.banner{display:flex;align-items:center;gap:10px;background:var(--banner);color:var(--banner-t);border-radius:14px;padding:12px 14px;margin:2px 0 14px;font-size:calc(14px * var(--uk,1));width:100%;text-align:left}
.banner b{font-weight:600}

/* notes */
.notes{display:flex;flex-direction:column;gap:10px}
.note{position:relative;display:grid;grid-template-columns:1fr 26px;gap:4px 10px;padding:16px 14px;background:var(--surface);border-radius:18px;
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;border:1px solid transparent;transition:background .15s}
.note.dragging{box-shadow:var(--shadow);z-index:2;background:var(--bg);border-color:var(--line)}
.note-side{display:flex;flex-direction:column;align-items:center;gap:8px;padding-top:1px}
.chk{width:22px;height:22px;border-radius:50%;border:1.6px solid var(--muted);display:grid;place-items:center}
.chk svg{width:14px;height:14px;stroke-width:3}
.note.done .chk{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.grip{color:var(--faint);touch-action:none;padding:4px 2px;cursor:grab}
.grip svg{width:16px;height:16px;fill:currentColor;stroke:none}
.note-main{min-width:0}
.note-text{font-size:calc(16px * var(--uk,1));line-height:1.55;white-space:pre-wrap;word-break:break-word}
.note:not(.ex) .note-text{display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden}
.note-text a,.note-text a:visited{color:var(--link);text-decoration:underline;text-underline-offset:2px}
.note-text:empty::before{content:'(사진 메모)';color:var(--muted)}
.note-meta{display:flex;align-items:center;gap:6px;margin-top:10px;font-size:calc(13px * var(--uk,1));color:var(--muted);min-width:0}
.note-ex{color:var(--muted);display:grid;place-items:start center;padding-top:2px;visibility:hidden}
.note.long .note-ex,.note.ex .note-ex{visibility:visible} /* 6줄 넘는 긴 메모에만 펼치기 */
.note-ex svg{width:17px;height:17px}
.note-imgs{display:flex;gap:6px;margin-top:10px;overflow-x:auto}
.note-imgs img{width:72px;height:72px;object-fit:cover;border-radius:10px;flex:none;background:var(--surface2)}
.note.ex .note-imgs img{width:auto;max-width:100%;height:auto;max-height:260px}
/* 메모 묶음: 아래로 이어진 메모는 들여서 선으로 연결 */
.ngroup{position:relative;display:flex;flex-direction:column}
.note.kid{margin:6px 0 0 24px}
.note.kid::before{content:'';position:absolute;left:-15px;top:-6px;height:calc(50% + 6px);width:11px;border-left:2px solid var(--line);border-bottom:2px solid var(--line);border-bottom-left-radius:10px}
.note.kid:not(:last-child)::after{content:'';position:absolute;left:-15px;top:50%;bottom:-6px;border-left:2px solid var(--line)}
/* 메모 편집 모드 */
.notes.editing .note{grid-template-columns:26px 1fr}
.notes.editing .note-ex{display:none}
.notes.editing .note-main a,.notes.editing .doc-chip{pointer-events:none} /* 편집 중엔 연결·링크가 열리지 않음 */
.ne-tip{font-size:calc(13px * var(--uk,1));color:var(--muted);margin:-6px 4px 12px}
.ne-chk{width:22px;height:22px;border-radius:50%;border:1.6px solid var(--muted);display:grid;place-items:center;margin-top:1px}
.ne-chk svg{width:14px;height:14px;stroke-width:3}
.note.sel .ne-chk{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.note.sel{border-color:var(--ink)}
.note.done .note-main{opacity:.5} /* 완료한 메모: 흐리게, 취소선 없음 */
.note.drop-into{box-shadow:0 0 0 2px var(--ink)}
.ngroup.dragging,.note.kid.dragging{z-index:3;opacity:.92}
.ngroup.dragging>.note,.note.kid.dragging{box-shadow:var(--shadow)}
.ngroup.drop-before::after{content:'';position:absolute;left:0;right:0;top:-7px;height:3px;border-radius:2px;background:var(--ink)}
.notes.drop-end::after{content:'';display:block;height:3px;border-radius:2px;background:var(--ink)}
.ne-bar{position:absolute;left:16px;right:16px;bottom:calc(18px + env(safe-area-inset-bottom));display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:20px;background:var(--ink);color:var(--onink);z-index:5}
.ne-bar button{display:flex;align-items:center;gap:6px;padding:8px 10px;font-size:calc(15px * var(--uk,1));font-weight:600;color:inherit}
.ne-bar .ne-n{flex:1;text-align:center;font-size:calc(14px * var(--uk,1));opacity:.8}
.ne-bar .ne-del svg,.ne-bar .ne-pin svg{width:18px;height:18px}
.ne-bar .ne-del:disabled,.ne-bar .ne-pin:disabled{opacity:.35}
.note-foot{grid-column:1/-1;display:flex;align-items:center;gap:8px;border-top:1px solid var(--line);margin-top:12px;padding-top:12px}
.colors{display:flex;gap:9px}
.cdot{width:20px;height:20px;border-radius:50%;border:1.6px solid var(--cc)}
.cdot.on{background:var(--cc)}
.note-foot .more{color:var(--muted);margin-left:auto;padding:0 4px}
.doc-chip{display:inline-flex;align-items:center;gap:4px;min-width:0;max-width:70%;color:var(--muted)}
.doc-chip span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.doc-chip svg{width:14px;height:14px}
.doc-chip.big{grid-column:1/-1;justify-self:start;margin-top:10px;background:var(--surface);border-radius:8px;padding:6px 10px;font-size:calc(13px * var(--uk,1));max-width:100%}
.note[data-c]:not([data-c="none"])::before{content:'';position:absolute;left:0;top:16px;bottom:16px;width:5px;border-radius:0 4px 4px 0;background:var(--cc)}

/* doc / folder list */
.stats{font-size:calc(13px * var(--uk,1));color:var(--muted);margin:-8px 4px 10px}
.list{display:flex;flex-direction:column}
.row{display:flex;gap:12px;padding:15px 4px;border-bottom:1px solid var(--line);-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;align-items:flex-start;text-align:left;width:100%}
.row:active{background:var(--surface);border-radius:12px}
.ico{display:grid;place-items:center;padding-top:1px}
.ico svg{width:20px;height:20px}
.row-main{flex:1;min-width:0}
.row-title{display:flex;gap:10px;align-items:baseline}
.row-title .t{flex:1;min-width:0;font-size:calc(16px * var(--uk,1));font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row-title .t em{font-style:normal;color:var(--muted);font-weight:400}
.row-title .time{font-size:calc(13px * var(--uk,1));color:var(--muted);flex:none}
.row-sub{font-size:calc(14px * var(--uk,1));color:var(--muted);margin-top:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.row-sub mark,.row-title mark{background:var(--mark);color:inherit;border-radius:3px;padding:0 1px}
.sec-title{font-size:calc(13px * var(--uk,1));font-weight:600;color:var(--muted);margin:18px 4px 4px}

.empty{text-align:center;color:var(--muted);padding:70px 20px;line-height:1.6}
.empty b{display:block;color:var(--text);font-size:calc(17px * var(--uk,1));font-weight:600;margin-bottom:6px}

.fab{position:absolute;right:20px;bottom:calc(22px + env(safe-area-inset-bottom));width:64px;height:64px;border-radius:50%;background:var(--ink);color:var(--onink);display:grid;place-items:center;box-shadow:var(--shadow)}
.fab svg{width:26px;height:26px}
.fab:active{transform:scale(.96)}

/* folder header */
.fhead{flex:1;min-width:0;display:flex;align-items:center;gap:10px;text-align:left}
.fhead .ico svg{width:22px;height:22px}
.fhead .tt{min-width:0}
.fhead .t{font-size:calc(16px * var(--uk,1));font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fhead .s{font-size:calc(12px * var(--uk,1));color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* drawer */
.drawer-wrap{position:fixed;inset:0;background:rgba(0,0,0,0);transition:background .22s;z-index:30}
.drawer-wrap.open{background:rgba(0,0,0,.28)}
.drawer{position:absolute;left:0;top:0;bottom:0;width:min(84vw,380px);background:var(--bg);border-radius:0 28px 28px 0;display:flex;flex-direction:column;
  padding:calc(env(safe-area-inset-top) + 22px) 10px calc(env(safe-area-inset-bottom) + 18px) 26px;margin-left:-16px;transform:translateX(-102%);transition:transform .24s cubic-bezier(.2,.8,.2,1);transition:transform .24s var(--spring);box-shadow:var(--shadow)} /* 튀어나갈 때 왼쪽 빈틈이 안 보이게 16px 숨겨 둠 */
.drawer-wrap.open .drawer{transform:none}
.dr-title{font-size:22px;font-weight:600;margin:6px 14px 18px}
.dr-acct{font-size:calc(14px * var(--uk,1));color:var(--muted);margin:-10px 14px 0;line-height:1.5}
.dr-menu{border-top:1px solid var(--line);margin:6px 14px 0;padding-top:6px}
.dr-menu button{display:flex;align-items:center;gap:16px;width:100%;min-height:48px;padding:13px 4px;font-size:calc(17px * var(--uk,1));text-align:left}
.dr-menu svg{color:var(--text)}
.dr-menu .sub{margin-left:auto;font-size:calc(12px * var(--uk,1));color:var(--muted)}

/* sheets */
#layer{position:relative;z-index:40}
.sheet-wrap{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);background:rgba(0,0,0,0);transition:background .22s;z-index:40}
.sheet-wrap.open{background:rgba(0,0,0,.3)}
.sheet{position:absolute;left:0;right:0;bottom:0;max-height:90%;overflow-y:auto;background:var(--sheet);border-radius:26px 26px 0 0;
  padding:8px 18px calc(40px + env(safe-area-inset-bottom));margin-bottom:-24px;transform:translateY(105%);transition:transform .24s cubic-bezier(.2,.8,.2,1);transition:transform .24s var(--spring)} /* 튀어오를 때 아래 빈틈이 안 보이게 24px 숨겨 둠 */
:root.kb .sheet{padding-bottom:12px}
.sheet-wrap.open .sheet{transform:none}
.grab{width:38px;height:5px;border-radius:3px;background:var(--surface2);margin:0 auto 12px}
.sh-head{padding:6px 4px 14px;border-bottom:1px solid var(--line);margin-bottom:6px}
.sh-head .h{display:flex;align-items:center;gap:10px;font-size:calc(18px * var(--uk,1));font-weight:600}
.sh-head .h .ico svg{width:22px;height:22px}
.sh-head .s{font-size:calc(14px * var(--uk,1));color:var(--muted);margin-top:5px;line-height:1.5}
.sh-item{display:flex;align-items:center;gap:14px;width:100%;padding:14px 4px;font-size:calc(16px * var(--uk,1));text-align:left}
.sh-item svg{color:var(--muted)}
.sh-item .ico svg{color:inherit}
.sh-item.danger,.sh-item.danger svg{color:var(--danger)}
.sh-item .ck{margin-left:auto;color:var(--text)}
.sh-item .sub{margin-left:auto;font-size:calc(13px * var(--uk,1));color:var(--muted)}
.sh-item:active{background:var(--surface);border-radius:12px}
.sh-sep{height:1px;background:var(--line);margin:4px 0}
.sh-title{font-size:calc(18px * var(--uk,1));font-weight:600;padding:2px 4px 12px}

.note-input{width:100%;min-height:150px;max-height:45vh;border:0;outline:none;background:transparent;resize:none;font-size:calc(17px * var(--uk,1));line-height:1.6;padding:4px}
.note-input::placeholder{color:var(--muted)}
.pin-mark{display:inline-flex;align-items:center;gap:3px;color:var(--muted)}
.pin-mark svg{width:13px;height:13px}
.sheet-actions{display:flex;align-items:center;gap:8px;padding-top:10px;border-top:1px solid var(--line)}
.ibtn{display:flex;align-items:center;gap:6px;height:40px;padding:0 12px;border-radius:12px;background:var(--surface);font-size:calc(14px * var(--uk,1));max-width:55%}
.ibtn span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pbtn{height:42px;padding:0 22px;border-radius:21px;background:var(--ink);color:var(--onink);font-weight:600;font-size:calc(15px * var(--uk,1))}
.pbtn.wide{width:100%;height:52px;border-radius:16px;font-size:calc(16px * var(--uk,1));margin-top:8px}
.sbtn{height:42px;padding:0 18px;border-radius:21px;background:var(--surface);font-weight:500;font-size:calc(15px * var(--uk,1))}
.thumbs{display:flex;gap:8px;overflow-x:auto;padding:6px 2px 10px}
.thumb{position:relative;flex:none}
.thumb img{width:68px;height:68px;object-fit:cover;border-radius:10px;display:block}
.thumb button{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;background:var(--ink);color:var(--onink);display:grid;place-items:center}
.thumb button svg{width:12px;height:12px;stroke-width:3}

.icon-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:8px;padding:6px 0 14px}
.icon-grid button{aspect-ratio:1;border-radius:14px;display:grid;place-items:center;background:var(--surface)}
.icon-grid button.on{box-shadow:inset 0 0 0 2px var(--ink)}
.color-row{display:flex;gap:12px;flex-wrap:wrap;padding:4px 2px 12px}
.color-row button{width:28px;height:28px;border-radius:50%;background:var(--cc)}
.color-row button.on{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--cc)}
.field{width:100%;height:50px;border-radius:14px;border:1px solid var(--line);background:var(--bg);padding:0 14px;font-size:calc(16px * var(--uk,1));outline:none;margin:4px 0 14px}
.field:focus{border-color:var(--ink)}
.lbl{font-size:calc(13px * var(--uk,1));color:var(--muted);margin:6px 4px 4px}

/* modal */
.modal-wrap{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);background:rgba(0,0,0,.32);display:grid;place-items:center;z-index:60;padding:20px}
.modal{width:min(100%,340px);background:var(--sheet);border-radius:22px;padding:22px 20px 16px;box-shadow:var(--shadow)}
.m-title{font-size:calc(18px * var(--uk,1));font-weight:600;margin-bottom:8px}
.m-msg{font-size:calc(14px * var(--uk,1));color:var(--muted);line-height:1.55;margin-bottom:12px;white-space:pre-line}
.m-input{width:100%;height:48px;border-radius:12px;border:1px solid var(--line);background:var(--bg);padding:0 14px;font-size:calc(16px * var(--uk,1));outline:none;margin-bottom:10px}
.m-input:focus{border-color:var(--ink)}
.m-btns{display:flex;gap:8px;margin-top:8px}
.m-btns button{flex:1;height:48px;border-radius:14px;background:var(--surface);font-weight:600;font-size:calc(15px * var(--uk,1))}
.m-btns .primary{background:var(--ink);color:var(--onink)}
.m-btns .danger{background:var(--danger);color:#fff}

.toast{position:fixed;left:50%;bottom:calc(110px + env(safe-area-inset-bottom));transform:translate(-50%,20px);opacity:0;background:var(--ink);color:var(--onink);width:max-content;display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;
  padding:12px 18px;border-radius:24px;font-size:calc(14px * var(--uk,1));z-index:80;transition:all .22s;max-width:calc(100vw - 32px);text-align:center;pointer-events:none}
.toast .tm{min-width:0;overflow:hidden;text-overflow:ellipsis}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.has-undo{gap:6px;padding:4px 6px 4px 18px;text-align:left}
.toast.has-undo.show{pointer-events:auto}
.toast button{flex:none;white-space:nowrap;min-height:44px;min-width:44px;padding:0 12px;border:0;background:none;color:var(--toast-act);font:inherit;font-weight:600}

/* search */
.search-box{flex:1;min-width:0;display:flex;align-items:center;gap:8px;height:46px;border-radius:23px;background:var(--surface);padding:0 14px;color:var(--muted)}
.search-box input{flex:1;border:0;outline:none;background:transparent;font-size:calc(16px * var(--uk,1));color:var(--text);min-width:0}
.txtbtn{font-size:calc(16px * var(--uk,1));padding:0 4px;flex:none}

/* editor */
.ed-top .ed-head{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center}
.ed-head .t{font-size:calc(15px * var(--uk,1));font-weight:600;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ed-head .s{font-size:calc(12px * var(--uk,1));color:var(--muted);margin-top:2px}
.ed-head .s.warn{color:#D9730D}.ed-head .s.full{color:var(--danger)} /* 한 화 1만 자: 9천 자부터 주황, 꽉 차면 빨강 (2팀) */
.ed-scroll{padding:0;background:var(--ed-bg)}
.editor .topbar{background:var(--ed-bg)}
.paper{max-width:720px;margin:0 auto;padding:18px 22px 45vh;font-family:var(--ed-ff);color:var(--ed-fc)}
.ed-title{display:block;width:100%;border:0;outline:none;background:transparent;resize:none;padding:0;font-family:inherit;font-size:26px;font-weight:700;line-height:1.35;color:inherit;overflow:hidden;letter-spacing:-.01em}
.ed-sub{display:block;width:100%;border:0;outline:none;background:transparent;resize:none;padding:0;margin-top:8px;font-family:inherit;font-size:calc(15px * var(--uk,1));line-height:1.5;color:var(--muted);overflow:hidden}
.ed-title::placeholder,.ed-sub::placeholder{color:var(--muted)}
.ed-rule{height:1px;background:var(--line);margin:20px 0 24px}
.ed-body{position:relative;outline:none;font-size:var(--ed-fs);line-height:var(--ed-lh);letter-spacing:var(--ed-ls);word-break:keep-all;overflow-wrap:anywhere;min-height:40vh;-webkit-user-select:text;user-select:text;caret-color:var(--ink)}
.ed-body>p,.ed-body>div{margin:0 0 var(--ed-pgap);text-indent:var(--ed-indent)}
.ed-body>h3{font-size:1.12em;font-weight:700;margin:1.6em 0 .5em;text-indent:0;line-height:1.4}
.ed-body>h3:first-child{margin-top:0}
.ed-body.ed-empty::before{content:'여기에 글을 쓰세요';color:var(--muted);position:absolute;left:0;top:0;text-indent:var(--ed-indent);pointer-events:none}
.ed-body.ed-empty:focus::before{content:none} /* 본문을 누르면 안내 문구 숨김, 비운 채 나가면 다시 보임 */
.ed-body img{display:block;max-width:100%;height:auto;border-radius:10px;margin:10px auto}
.ed-body img.sz-s{max-width:32%}
.ed-body img.half,.ed-body img.sz-m{max-width:49%} /* 예전 '작게'(.half)는 '중간'으로 보임 */
.ed-body img.al-l{margin-left:0;margin-right:auto}
.ed-body img.al-r{margin-left:auto;margin-right:0}
/* 묶음 사진: 한 번에 넣은 여러 장을 한 덩어리로 나란히 (작게 한 줄 3장, 중간 2장, 크게 1장) */
.ed-body .pgroup{display:flex;flex-wrap:wrap;justify-content:center;gap:10px 2%;margin:10px 0}
.ed-body .pgroup.al-l{justify-content:flex-start}
.ed-body .pgroup.al-r{justify-content:flex-end}
.ed-body .pgroup img{margin:0;max-width:none;width:49%;aspect-ratio:1;object-fit:cover}
.ed-body .pgroup.sz-s img{width:32%}
.ed-body .pgroup:not(.sz-s):not(.sz-m) img{width:100%;aspect-ratio:auto}
.ed-body .pgroup.sel{outline:3px solid var(--link);outline-offset:2px;border-radius:10px}
.ed-body img.sel{outline:3px solid var(--link);outline-offset:2px}
.ed-body a{color:var(--link);text-decoration:underline;text-underline-offset:3px}
.ed-body hr,.preview hr{border:0;border-top:1px solid currentColor;height:0;width:100%;margin:28px 0;color:var(--ed-fc);opacity:.45}
::highlight(q){background-color:var(--mark)}
.page-mode .ed-scroll{background:var(--surface2)}
.page-mode .topbar{background:var(--surface2)}
.page-mode .paper{background:var(--ed-bg);width:calc(100% - 24px);max-width:680px;margin:6px auto 45vh;padding:46px 30px 90px;border-radius:6px;box-shadow:0 2px 16px rgba(0,0,0,.08);min-height:115vh}

.toolbar{flex:none;padding:6px 10px calc(8px + env(safe-area-inset-bottom));background:var(--ed-bg);display:flex;flex-direction:column;gap:6px}
.page-mode .toolbar{background:var(--surface2)}
:root.kb .toolbar{padding-bottom:6px}
.tb-pill{display:flex;align-items:center;gap:2px;overflow-x:auto;scrollbar-width:none;background:var(--bg);border:1px solid var(--line);border-radius:18px;padding:5px 6px;box-shadow:0 2px 10px rgba(0,0,0,.05)}
.tb-pill::-webkit-scrollbar{display:none}
.tb-pill>button{flex:none;min-width:36px;height:36px;border-radius:11px;display:grid;place-items:center;font-size:calc(16px * var(--uk,1));padding:0 6px}
.tb-pill>button.on{background:var(--surface2)}
.tb-pill>button.chip{font-size:calc(14px * var(--uk,1));padding:0 10px;white-space:nowrap}
.tb-pill>button.chip.on{background:var(--surface2);font-weight:600}
.tb-pill .sep{width:1px;height:20px;background:var(--line);margin:0 4px;flex:none}
.tb-pill svg{width:20px;height:20px}
.swatch{width:20px;height:20px;border-radius:50%;background:var(--ed-fc);box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.sw{width:30px!important;min-width:30px!important;height:30px!important;border-radius:50%!important;background:var(--cc)!important;box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);margin:0 3px}
.sw.none{background:linear-gradient(135deg,transparent 46%,var(--danger) 47%,var(--danger) 53%,transparent 54%)!important;box-shadow:inset 0 0 0 1.5px var(--line)}
.pop{display:flex;align-items:center;gap:6px;background:var(--ink);color:var(--onink);border-radius:16px;padding:6px 6px 6px 14px;font-size:calc(14px * var(--uk,1))}
.pop .u{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.85}
.pop.pop-img{flex-wrap:wrap;padding:6px;gap:6px}
.pop .pg{display:flex;gap:2px;background:rgba(255,255,255,.08);border-radius:12px;padding:2px}
.pop .pg button{padding:0 10px}
.pop button.on{background:var(--onink);color:var(--ink)}
.pop button{height:34px;padding:0 12px;border-radius:11px;background:rgba(255,255,255,.14);font-size:calc(14px * var(--uk,1));flex:none}
:root[data-theme="dark"] .pop button{background:rgba(0,0,0,.1)}

/* body settings */
.bs-preview{flex:none;height:30vh;background:var(--surface);padding:16px 16px 0;overflow:hidden}
.bs-preview .preview{height:100%;overflow:hidden;background:var(--ed-bg);color:var(--ed-fc);font-family:var(--ed-ff);border-radius:6px 6px 0 0;padding:22px 20px;box-shadow:0 1px 8px rgba(0,0,0,.06)}
.preview .ed-body{min-height:0}
.bs{padding-top:6px}
.bs-sec{padding:16px 2px;border-bottom:1px solid var(--line)}
.bs-label{display:flex;justify-content:space-between;align-items:center;font-size:calc(15px * var(--uk,1));margin-bottom:12px}
.bs-label .v{font-size:calc(14px * var(--uk,1));background:var(--surface);border-radius:8px;padding:4px 10px;color:var(--muted)}
.bs-sec.inline{display:flex;align-items:center;justify-content:space-between}
.bs-sec.inline .bs-label{margin:0}
.bs-group{font-size:19px;font-weight:600;margin:26px 2px 4px}
.chips{display:flex;gap:8px;flex-wrap:wrap}
.chips button{height:38px;padding:0 14px;border-radius:19px;background:var(--surface);font-size:calc(15px * var(--uk,1))}
.chips button.on{background:var(--ink);color:var(--onink)}
.chips button.off{opacity:.35}
.swatches{display:flex;gap:10px;overflow-x:auto;padding:4px 2px;scrollbar-width:none}
.swatches button{flex:none;width:34px;height:34px;border-radius:50%;background:var(--cc);box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.swatches.sq button{border-radius:10px}
.swatches button.on{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--ink)}
.swatches button.none{background:linear-gradient(135deg,var(--bg) 46%,var(--text) 47%,var(--text) 52%,var(--bg) 53%);box-shadow:inset 0 0 0 1.5px var(--line)}
.swatches button.none.on{box-shadow:inset 0 0 0 2px var(--ink)}
input[type=range]{-webkit-appearance:none;appearance:none;width:100%;height:28px;background:transparent;margin:0;touch-action:pan-y} /* 슬라이더 위에서 위아래로 밀면 화면이 스크롤되게 (iOS) */
input[type=range]::-webkit-slider-runnable-track{height:5px;border-radius:3px;background:linear-gradient(var(--ink),var(--ink)) 0/var(--p,50%) 100% no-repeat,var(--surface2)}
input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;width:28px;height:28px;border-radius:50%;background:#fff;border:1px solid var(--line);box-shadow:0 1px 5px rgba(0,0,0,.2);margin-top:-11.5px}
input[type=range]::-moz-range-track{height:5px;border-radius:3px;background:var(--surface2)}
input[type=range]::-moz-range-progress{height:5px;border-radius:3px;background:var(--ink)}
input[type=range]::-moz-range-thumb{width:26px;height:26px;border-radius:50%;background:#fff;border:1px solid var(--line)}
.seg{display:flex;gap:8px}
.seg button{height:40px;padding:0 20px;border-radius:20px;background:var(--surface);font-size:calc(15px * var(--uk,1))}
.seg button.on{background:var(--ink);color:var(--onink)}
.toggle{width:52px;height:32px;border-radius:16px;background:var(--surface2);position:relative;transition:background .2s;flex:none}
.toggle::after{content:'';position:absolute;top:3px;left:3px;width:26px;height:26px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .2s}
.toggle.on{background:var(--ink)}
.toggle.on::after{transform:translateX(20px)}

/* settings */
.group{background:var(--surface);border-radius:18px;overflow:hidden;margin:10px 0 6px}
.group .item{display:flex;align-items:center;gap:12px;padding:15px 16px;border-bottom:1px solid var(--line);width:100%;text-align:left;font-size:calc(16px * var(--uk,1))}
.group .item:last-child{border-bottom:0}
.group .item .sub{margin-left:auto;font-size:calc(13px * var(--uk,1));color:var(--muted);text-align:right}
.group .item .toggle{margin-left:auto}
.group .item svg{color:var(--muted)}
.gtitle{font-size:calc(13px * var(--uk,1));font-weight:600;color:var(--muted);margin:22px 6px 4px}
.note-box{font-size:13.5px;color:var(--muted);line-height:1.6;padding:6px 6px}
.privacy{display:flex;gap:12px;align-items:flex-start;background:var(--surface);border-radius:18px;padding:16px;font-size:calc(14px * var(--uk,1));line-height:1.6;margin-top:6px}
.privacy svg{color:var(--text);margin-top:2px}
.privacy b{display:block;font-size:calc(15px * var(--uk,1));margin-bottom:2px}

/* ===== 인물관계도 ===== */
.cv{flex:1;position:relative;overflow:hidden;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
  background:radial-gradient(circle,var(--line) 1.2px,transparent 1.4px) 0 0/24px 24px,var(--bg)}
.world{position:absolute;left:0;top:0;transform-origin:0 0}
.edges{position:absolute;overflow:visible;pointer-events:none}
.eg .hit{fill:none;stroke:transparent;stroke-width:24;pointer-events:stroke}
.eg .ln{fill:none;stroke:var(--ec);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.eg .ln.dash{stroke-dasharray:10 9}
.eg polygon{fill:var(--ec)}
.eg.sel .ln{stroke-width:5}
.eg .lb{fill:var(--ec);font-family:inherit;font-size:calc(14px * var(--uk,1));font-weight:700;dominant-baseline:central;pointer-events:auto}
.eg .lbg{fill:var(--bg);stroke:var(--ec);stroke-width:3;pointer-events:auto} /* 관계 이름은 흰 바 위에 */
.nd{position:absolute;width:calc(var(--r) * 2 + 60px);transform:translate(-50%,calc(var(--r) * -1));text-align:center;cursor:grab}
.nd-c{width:calc(var(--r) * 2);height:calc(var(--r) * 2);margin:0 auto;border-radius:50%;background:var(--nb);border:4px solid var(--nc,var(--nb));overflow:hidden;display:grid;place-items:center;
  transition:box-shadow .15s} /* 동그라미 뒤 그림자 없음 */
.nd-c img{width:100%;height:100%;object-fit:cover;pointer-events:none}
.nd-c span{font-size:calc(var(--r) * .8);font-weight:700;color:rgba(0,0,0,.45)}
.nd-n{display:inline-block;margin-top:8px;padding:3px 10px;font-size:calc(14px * var(--lk,1));font-weight:700;color:var(--text);line-height:1.3;background:var(--bg);border:1px solid var(--line);border-radius:7px} /* 이름은 흰 바 위에 */
.nd.big .nd-n{font-size:calc(17px * var(--lk,1))}
.nd-s{font-size:calc(13px * var(--lk,1));font-weight:500;color:var(--muted);margin-top:3px;word-break:keep-all; /* 낱말 중간에서 줄바꿈하지 않게 */
  /* 설명 글자에 흰 테두리: 관계선 위를 지나가도 글자가 묻히지 않게 */
  text-shadow:-1.5px -1.5px 0 var(--bg),1.5px -1.5px 0 var(--bg),-1.5px 1.5px 0 var(--bg),1.5px 1.5px 0 var(--bg),0 -2px 0 var(--bg),0 2px 0 var(--bg),-2px 0 0 var(--bg),2px 0 0 var(--bg),0 0 5px var(--bg)}
.nd.sel .nd-c{box-shadow:0 0 0 3px var(--bg),0 0 0 5.5px var(--ink)}
.nd.from .nd-c{box-shadow:0 0 0 3px var(--bg),0 0 0 8px var(--rel-love);transition:box-shadow .2s} /* 계속 깜빡이던 표시를 굵은 고정 테두리로 */
.grp{position:absolute;background:var(--bg);border-radius:22px;border:4px solid var(--gc)} /* 그룹: 테두리만 색, 안은 흰색 */
.grp.sel{box-shadow:0 0 0 3px var(--bg),0 0 0 5px var(--ink)}
.grp-t{position:absolute;top:0;left:50%;transform:translate(-50%,-50%);background:var(--gc);color:#fff;padding:6px 18px;border-radius:999px; /* 그룹 이름: 위쪽 가운데, 테두리 색 배경 */
  font-size:calc(15px * var(--uk,1));font-weight:700;white-space:nowrap;letter-spacing:-.01em}
.grp-rs{position:absolute;right:-8px;bottom:-8px;width:30px;height:30px;border-radius:50%;background:var(--ink);display:none;
  box-shadow:0 0 0 3px var(--bg)}
.grp.sel .grp-rs{display:block}
.legend{position:absolute;top:8px;left:12px;right:12px;height:30px;display:flex;align-items:center;gap:6px;overflow:hidden;font-size:12.5px;z-index:2} /* 2팀 시안 6: 머리말 아래 한 줄 칩 */
.legend>div{flex:none;display:flex;align-items:center;height:30px;padding:0 10px;border-radius:15px;background:var(--bg);border:1px solid var(--line)}
.legend .lg-more{display:none;flex:none;margin-left:auto;height:30px;padding:0 12px;border-radius:15px;background:var(--surface);font-size:12.5px;font-weight:600}
.legend.over .lg-more{display:block;position:absolute;right:0;top:0;box-shadow:-8px 0 8px var(--bg)}
.legend.open .lg-more{position:static}
.legend.open{height:auto;flex-wrap:wrap;overflow:visible}
.legend i{display:inline-block;width:22px;height:2.5px;border-radius:2px;margin-right:7px;vertical-align:middle;background:var(--lc)}
.legend i.dash,.rel-chips i.dash{background:repeating-linear-gradient(90deg,var(--lc) 0 5px,transparent 5px 9px)}
.cv.locked .nd{cursor:default}
.cv-hint{position:absolute;left:50%;top:12px;transform:translateX(-50%);background:var(--ink);color:var(--onink);padding:10px 16px;border-radius:20px;font-size:calc(14px * var(--uk,1));
  pointer-events:none;white-space:nowrap;max-width:calc(100% - 140px);overflow:hidden;text-overflow:ellipsis}
.cv-empty{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;color:var(--muted);
  font-size:calc(14px * var(--uk,1));line-height:1.7;pointer-events:none;padding:20px}
.cv-empty svg{width:40px;height:40px;margin-bottom:8px}
.cv-empty b{color:var(--text);font-size:calc(17px * var(--uk,1));margin-bottom:4px}
.cv-bar{flex:none;display:flex;gap:5px;justify-content:flex-start;padding:10px 6px calc(10px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--line);overflow-x:auto;scrollbar-width:none}
.cv-bar button{display:flex;align-items:center;gap:6px;height:44px;padding:0 10px;border-radius:22px;background:var(--surface);font-size:calc(14px * var(--uk,1));white-space:nowrap;flex:none}
.cv-bar button svg{width:18px;height:18px}
.cv-bar button.pri{background:var(--ink);color:var(--onink)}
.cv-bar button.on{background:var(--mark)}
.cv-bar button.dan{color:var(--danger)}
.ph-pick{width:100px;height:100px;border-radius:50%;border:5px solid transparent;margin:0 auto 14px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;overflow:hidden;color:rgba(0,0,0,.5);font-size:calc(12px * var(--uk,1))}
.ph-pick img{width:100%;height:100%;object-fit:cover}
.frow{display:flex;gap:8px}
.frow .field{flex:1;min-width:0}
.frow .field.age{flex:0 0 90px}
.rel-chips button{display:flex;align-items:center;gap:7px}
.rel-chips i{width:16px;height:3px;border-radius:2px;background:var(--lc)}
.rel-chips button.on i{box-shadow:0 0 0 1.5px var(--onink)}
.cv-bar button{transition:color .25s}
.cv-bar button.flash svg{animation:wiggle .3s 1}

/* ===== 플롯 ===== */
.cbtn.pri{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.cbtn.flash{animation:wiggle .3s 1}
@keyframes wiggle{25%{transform:rotate(-14deg) scale(1.15)}75%{transform:rotate(14deg) scale(1.15)}}
.plot{padding-top:2px}
.plot textarea{display:block;width:100%;border:0;outline:none;resize:none;background:transparent;font:inherit;color:var(--text);overflow:hidden;padding:0;margin:0}
.plot textarea::placeholder{color:var(--muted);font-weight:400}
.st-empty{font-size:calc(14px * var(--uk,1));color:var(--muted);padding:22px 0 6px}
.arc{padding:18px 0 10px;border-bottom:1px solid var(--line);background:var(--bg)}
.arc:last-child{border-bottom:0}
.arc-row,.ep-row{display:flex;align-items:flex-start;gap:8px}
.arc-no{flex:none;font-size:calc(17px * var(--uk,1));font-weight:800;line-height:1.5;letter-spacing:-.01em;white-space:nowrap}
.arc-t{flex:1;min-width:0;font-size:calc(17px * var(--uk,1));font-weight:700;line-height:1.5;word-break:keep-all;overflow-wrap:anywhere}
.lk-emo{flex:none;width:32px;height:28px;display:grid;place-items:center;color:var(--muted);border-radius:8px}
.lk-emo svg{width:18px;height:18px}
.lk-emo:active{background:var(--surface)}
.lk-emo .ico svg{width:18px;height:18px}
.pl-grip{flex:none;color:var(--faint);touch-action:none;padding:4px 2px;cursor:grab}
.pl-grip svg{width:16px;height:16px;fill:currentColor;stroke:none}
.eps{margin:6px 0 0 4px;padding-left:12px;border-left:2px solid var(--line);min-height:4px}
.plot.locked .eps:empty{display:none}
.ep{padding:7px 0;background:var(--bg);-webkit-user-select:none;user-select:none}
.ep.dragging,.arc.dragging{box-shadow:var(--shadow);border-radius:12px;position:relative;z-index:2;padding-left:8px;padding-right:8px;background:var(--bg)}
.ep-dash{flex:none;color:var(--muted);font-size:calc(15px * var(--uk,1));line-height:1.6;width:10px}
.ep-t{flex:1;min-width:0;font-size:calc(15px * var(--uk,1));line-height:1.6;word-break:keep-all;overflow-wrap:anywhere}
.ep-add,.arc-add{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:calc(14px * var(--uk,1));padding:8px 0}
.ep-add{margin-left:18px}
.ep-add svg,.arc-add svg{width:16px;height:16px}
.arc-add{font-weight:600;color:var(--text);padding:14px 0 4px}
.plot textarea.arc-t{font-size:calc(17px * var(--uk,1));font-weight:700;line-height:1.5}
.plot textarea.ep-t{font-size:calc(16px * var(--uk,1));line-height:1.6}

/* ===== 메모 입력창 (채팅창처럼 아래에 한 줄) ===== */
.scroll.with-composer{padding-bottom:110px}
.composer{position:absolute;left:14px;right:14px;bottom:calc(14px + env(safe-area-inset-bottom));display:flex;flex-direction:column;gap:2px;padding:8px 8px 8px 16px;background:var(--bg);border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow);z-index:5}
.composer textarea{flex:1;min-width:0;border:0;outline:none;resize:none;background:transparent;font:inherit;font-size:calc(16px * var(--uk,1));line-height:1.5;color:var(--text);padding:6px 0;height:36px;max-height:calc(var(--vvh,100dvh)*.35);overflow-y:auto}
.composer textarea::placeholder{color:var(--muted)}
.composer.open{border-radius:20px}
.cmp-send{flex:none;width:36px;height:36px;border-radius:50%;background:var(--ink);color:var(--onink);display:grid;place-items:center}
.cmp-send svg{width:18px;height:18px;stroke-width:2.2}
.row-title .time .pin-i{display:inline-block;width:13px;height:13px;vertical-align:-2px;margin-right:4px;color:var(--text)}
/* 글쓰기 편집 모드 */
.list.editing .row{align-items:center}
.list.editing .row .ne-chk{flex:none}
.list.editing .row.sel{background:var(--surface);border-radius:12px}
.list.editing .row.sel .ne-chk{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.ne-bar .ne-pin{padding:8px 6px}
/* 글쓰기 도구막대: Aa 패널 */
.tb-pill>button.tb-aa{font-size:calc(18px * var(--uk,1));font-weight:500;letter-spacing:-.01em;padding:0 10px}
#tbPanel.aa{flex-wrap:wrap;row-gap:4px;overflow-x:visible}
#tbPanel .br{flex-basis:100%;height:0}
.ed-body ul{margin:0 0 var(--ed-pgap);padding-left:1.4em}
.ed-body li{text-indent:0}
/* 원고 ↔ 메모 연결 */
.ed-subrow{display:flex;align-items:flex-start;gap:10px}
.ed-subrow .ed-sub{flex:1;min-width:0}
.ed-memos{flex:none;margin-top:6px;display:flex;align-items:center;gap:5px;padding:2px 4px;border-radius:8px;color:var(--muted);font-size:calc(13px * var(--uk,1));font-family:var(--font, inherit)}
.ed-memos:active{background:var(--surface)}
.ms-stack{display:flex;padding-left:8px}
.ms-ic{width:24px;height:24px;margin-left:-8px;border-radius:50%;display:grid;place-items:center;background:var(--ed-bg);border:1px solid var(--line);color:var(--muted)}
.ms-ic svg{width:14px;height:14px}
.ms-add{display:flex;align-items:center;gap:3px;color:var(--muted)}
.ms-add svg{width:13px;height:13px}
.dm-list{display:flex;flex-direction:column;gap:8px;margin:4px 0 14px;max-height:55vh;overflow-y:auto}
.dm-item{display:flex;gap:6px;align-items:flex-start;padding:12px 10px 12px 14px;border-radius:14px;background:var(--surface)}
.dm-item.kid{margin-left:22px}
.dm-item{position:relative}
.dm-item[data-c]:not([data-c="none"])::before{content:'';position:absolute;left:0;top:14px;bottom:14px;width:4px;border-radius:0 4px 4px 0;background:var(--cc)} /* 메모 색 막대 (메모 목록과 같게) */
.dm-text{flex:1;min-width:0;text-align:left;font-size:calc(15px * var(--uk,1));line-height:1.55;white-space:pre-wrap;word-break:break-word;color:var(--text)}
.dm-x{flex:none;padding:2px;color:var(--muted)}
.dm-empty{padding:18px 4px 22px;text-align:center;font-size:calc(14px * var(--uk,1));color:var(--muted)}
.dm-list.pick{gap:2px}
.dm-pick{display:flex;align-items:center;gap:12px;width:100%;padding:10px 6px;border-radius:12px;text-align:left}
.dm-pick.kid{padding-left:30px}
.dm-pick.sel{background:var(--surface)}
.dm-pick.sel .ne-chk{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.dm-line{flex:1;min-width:0;font-size:calc(15px * var(--uk,1));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dm-line small{display:block;font-size:calc(12px * var(--uk,1));color:var(--muted)}
.pbtn:disabled{opacity:.4}
/* 글쓰기 순서 끌기 */
#dlist .row{position:relative}
#dlist .row.dragging:not(.sel){background:var(--bg)}
#dlist .row.dragging{z-index:3;box-shadow:var(--shadow);border-radius:12px}
#dlist .row.drop-before::before{content:'';position:absolute;left:0;right:0;top:-2px;height:3px;border-radius:2px;background:var(--ink)}
#dlist .row.drop-in{outline:2px solid var(--ink);outline-offset:-2px;border-radius:12px;background:var(--surface)}
#dlist .row.drag-ghost{opacity:.4}
#dlist .row .drag-n{position:absolute;right:10px;top:-8px;padding:2px 8px;border-radius:10px;background:var(--ink);color:var(--onink);font-size:calc(12px * var(--uk,1));font-weight:600}
#dlist.drop-end::after{content:'';display:block;height:3px;border-radius:2px;background:var(--ink)}
/* 인물관계도: 그룹에 넣을 인물 고르기 */
.pp-list{display:flex;flex-direction:column;gap:2px;max-height:55vh;overflow-y:auto;margin:4px 0 14px}
.pp-item{display:flex;align-items:center;gap:12px;width:100%;padding:8px 6px;border-radius:12px;text-align:left}
.pp-item.sel{background:var(--surface)}
.pp-item.sel .ne-chk{background:var(--ink);border-color:var(--ink);color:var(--onink)}
.pp-av{flex:none;width:36px;height:36px;border-radius:50%;background:var(--nb);display:grid;place-items:center;font-weight:700;overflow:hidden}
.pp-av img{width:100%;height:100%;object-fit:cover}
.pp-n{flex:1;min-width:0;font-size:calc(16px * var(--uk,1));font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pp-item:disabled{opacity:.45}
.pp-n small{display:block;font-size:calc(12px * var(--uk,1));font-weight:400;color:var(--muted)}
.cpop{position:absolute;left:-6px;bottom:48px;display:flex;gap:10px;padding:10px 12px;background:var(--bg);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow);z-index:3}
.cpop[hidden]{display:none}
.cpop .cdot{width:24px;height:24px;background:var(--cc);border:0}
.cpop .cdot.on{box-shadow:0 0 0 2px var(--bg),0 0 0 3.5px var(--cc)}
.cmp-main{display:flex;align-items:flex-end;gap:8px}
.cmp-thumbs{padding:6px 0 0}
/* 메모 편집 창 (아이폰 기본 시트 방식): 취소 · 제목 · 완료 / 연결된 곳 / 사진 · 색 ··· ⋯ */
.ns-head{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;margin:-4px 0 8px}
.ns-cancel{justify-self:start;font-size:calc(16px * var(--uk,1));color:var(--muted);padding:6px 2px}
.ns-title{font-size:calc(16px * var(--uk,1));font-weight:600}
.ns-done{justify-self:end;font-size:calc(16px * var(--uk,1));font-weight:700;color:var(--text);padding:6px 2px}
.ns-dest{display:inline-flex;align-items:center;gap:5px;max-width:100%;margin:2px 0 6px;padding:6px 2px;font-size:calc(13px * var(--uk,1));color:var(--muted)}
.ns-dest span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ns-dest.on{color:var(--text)}
.ns-dest svg{width:14px;height:14px;flex:none}
.ns-dest[hidden]{display:none}
.ns-bar{display:flex;align-items:center;gap:4px;padding-top:6px;border-top:1px solid var(--line)}
.nb{width:44px;height:44px;display:grid;place-items:center;border-radius:12px;color:var(--text)}
.nb:active{background:var(--surface)}
.nb svg{width:22px;height:22px}
.swatch-dot{display:block;width:20px;height:20px;border-radius:50%;background:var(--cc);box-shadow:inset 0 0 0 1px rgba(0,0,0,.12)}
.swatch-dot.none{background:var(--line)}
.ns-pop-wrap{position:relative;flex:none}
.ns-menu{position:absolute;right:0;bottom:50px;z-index:4;display:flex;flex-direction:column;min-width:190px;padding:6px;background:var(--bg);border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow)}
.ns-menu[hidden]{display:none}
.ns-menu button{display:flex;align-items:center;gap:10px;padding:11px 10px;border-radius:10px;font-size:calc(15px * var(--uk,1));text-align:left;white-space:nowrap;color:var(--text)}
.ns-menu button:active{background:var(--surface)}
.ns-menu button svg{width:19px;height:19px}
.ns-menu .dan{color:var(--danger)}
/* 메모 입력창도 같은 막대 (펼쳤을 때만) */
.composer:not(.open) .cmp-bar,.composer:not(.open) .cmp-dest{display:none}
.composer:not(.open) textarea{overflow:hidden;clip-path:inset(0 0 6px 0)} /* 접힌 입력창에 남은 초안은 첫 줄만 */
.cmp-bar{border-top:0;padding-top:0;margin:2px 0 -4px -12px}
.cmp-dest{margin:4px 0 0}
/* 인물 여러 명 한 번에 추가 (표) */
.ps-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.ps-bulk{display:flex;align-items:center;gap:5px;font-size:calc(13px * var(--uk,1));font-weight:500;color:var(--muted);padding:6px 2px}
.ps-bulk svg{width:15px;height:15px}
.bp-hint{font-size:calc(13px * var(--uk,1));line-height:1.55;color:var(--muted);margin:-4px 2px 12px}
.bp-hint b{color:var(--text);font-weight:600}
.bp-table{display:flex;flex-direction:column;gap:6px;max-height:48vh;overflow-y:auto}
.bp-row{display:grid;grid-template-columns:44px 1fr 58px 1.3fr;gap:6px;align-items:center}
.bp-ph{width:44px;height:44px;border-radius:50%;border:1px dashed var(--line);display:grid;place-items:center;color:var(--muted);overflow:hidden}
.bp-ph svg{width:18px;height:18px}
.bp-ph.has{border:0}
.bp-ph img{width:100%;height:100%;object-fit:cover}
.bp-row .field{margin:0;min-width:0;padding:0 10px}
.bp-more{display:flex;align-items:center;gap:5px;margin:10px 2px 14px;font-size:calc(14px * var(--uk,1));color:var(--muted)}
.bp-more svg{width:15px;height:15px}
/* 그룹 색 고르기 */
.cv-bar .gc-dot{width:16px;height:16px;border-radius:50%;background:var(--bg);border:3px solid var(--gc)}
.gc-row{padding:8px 2px 18px;gap:14px}
.gc-row button{width:34px;height:34px}
/* 인물관계도: 텍스트로 보기 */
.cv-text{position:absolute;inset:0;overflow-y:auto;padding:14px 18px 30px;background:var(--bg);z-index:2;-webkit-overflow-scrolling:touch}
.cv-text[hidden]{display:none}
.ct-sec{padding:14px 0;border-bottom:1px solid var(--line)}
.ct-sec:last-child{border-bottom:0}
.ct-h{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.ct-pill{background:var(--gc);color:#fff;font-size:calc(14px * var(--uk,1));font-weight:700;padding:4px 14px;border-radius:999px}
.ct-t{font-size:calc(15px * var(--uk,1));font-weight:700}
.ct-m{font-size:calc(13px * var(--uk,1));color:var(--muted)}
.ct-p{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 2px;font-size:calc(15px * var(--uk,1))}
.ct-dot{width:12px;height:12px;border-radius:50%;border:3px solid var(--nc);flex:none}
.ct-tag{font-size:calc(11px * var(--uk,1));font-weight:600;color:var(--muted);background:var(--surface);padding:2px 6px;border-radius:6px}
.ct-r{display:flex;align-items:center;flex-wrap:wrap;gap:6px;padding:6px 2px;font-size:calc(15px * var(--uk,1))}
.ct-arr{font-weight:800}
.ct-kind{font-size:calc(12px * var(--uk,1));font-weight:700;color:var(--ec);border:1.5px solid var(--ec);border-radius:6px;padding:1px 7px}
/* 텍스트화: 동그라미 없이 이름표(+설명)만. 이름표 가운데가 인물 위치 */
.nd.txt{transform:translate(-50%,-14px)}
.nd.txt .nd-c{display:none}
.nd.txt .nd-n{margin-top:0;border:4px solid var(--nc)} /* 텍스트화: 이름표 테두리를 그룹 테두리와 같은 굵기로 */
.nd.txt.sel .nd-n{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--ink)}
.nd.txt.from .nd-n{box-shadow:0 0 0 2px var(--bg),0 0 0 4px var(--rel-love)}
/* 텍스트화: 이름표만 있는 가벼운 화면이라 선·테두리도 한 단계 얇고 부드럽게 (투박함 줄이기) */
#cv.txtmode .grp{border-width:2px;border-radius:18px}
#cv.txtmode .grp-t{padding:4px 14px;font-size:calc(13px * var(--uk,1))}
#cv.txtmode .nd.txt .nd-n{border-width:2px;border-radius:8px;padding:4px 11px;font-weight:600}
#cv.txtmode .eg .ln{stroke-width:1.8}
#cv.txtmode .eg.sel .ln{stroke-width:3.4}
#cv.txtmode .eg .lbg{stroke-width:1.6}
#cv.txtmode .eg .lb{font-size:calc(13px * var(--uk,1));font-weight:600}

/* 화면 왼쪽 끝에서 밀어 뒤로 가기 */
.screen.swiping{transition:none;box-shadow:-8px 0 24px rgba(0,0,0,.12)}
.screen.swipe-out{transition:transform .15s cubic-bezier(.2,.8,.2,1)}
.screen.swipe-cancel{transition:transform .2s ease-out}
.scroll.tab-swiping{transition:none}
.scroll.tab-anim{transition:transform .22s cubic-bezier(.2,.8,.2,1)}
@media (prefers-reduced-motion: reduce){.scroll.tab-anim{transition:none}}
.screen.swipe-in{animation:swipeIn .22s ease-out}
@keyframes swipeIn{from{transform:translateX(-24%);opacity:.6}to{transform:none;opacity:1}}
@media (prefers-reduced-motion: reduce){.screen.swipe-out,.screen.swipe-cancel{transition:none}.screen.swipe-in{animation:none}}
/* 2팀 움직임 규칙: 휴대폰의 '동작 줄이기'가 켜져 있으면 앱 전체에서 움직임 없이 바로 바뀜 */
@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important}}

/* 백업: 보관할 곳 선택지 (2팀 시안 A) */
.bx-opt{display:flex;align-items:center;gap:14px;width:100%;min-height:66px;padding:12px 14px;margin-top:10px;border-radius:16px;background:var(--surface);text-align:left}
.bx-opt:active{opacity:.7}
.bx-ic{flex:none;width:38px;height:38px;border-radius:11px;background:var(--ink);color:var(--onink);display:grid;place-items:center}
.bx-ic svg{width:20px;height:20px}
.bx-t{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.bx-t b{font-size:calc(16px * var(--uk,1));font-weight:600;display:flex;align-items:center;gap:6px}
.bx-t em{font-style:normal;font-size:calc(11px * var(--uk,1));font-weight:600;padding:2px 7px;border-radius:9px;background:var(--ink);color:var(--onink)}
.bx-t small{font-size:calc(13px * var(--uk,1));color:var(--muted)}
.bx-opt > svg{flex:none;width:18px;height:18px;color:var(--muted)}
.bx-meta{font-size:calc(12px * var(--uk,1));color:var(--muted);text-align:center;margin:14px 0 4px}

/* 누름 반응 (2팀 규칙): 줄·메뉴형은 배경색, 버튼·카드형은 0.97배. 누르는 순간 0.08초, 뗄 때 0.2초 */
.group .item{transition:background .15s ease-out}
.group .item:active{background:var(--surface2);transition:none}
.note,.pbtn,.sbtn,.chips button,.tb-pill>button,.ed-head,.banner,.m-btns button{transition:transform .2s cubic-bezier(.2,.8,.2,1)}
.note:active,.pbtn:active,.sbtn:active,.chips button:active,.tb-pill>button:active,.ed-head:active,.banner:active,.m-btns button:active{transform:scale(.97);transition:transform .08s cubic-bezier(.2,.8,.2,1)}
.bigtabs button{transition:color .15s ease-out}
.bigtabs button:active{color:var(--text)}
.note.dragging:active,.note.sel:active{transform:none}
@media (prefers-reduced-motion: reduce){
  .note:active,.pbtn:active,.sbtn:active,.chips button:active,.tb-pill>button:active,.ed-head:active,.banner:active,.m-btns button:active{transform:none}
  .note:active,.sbtn:active,.chips button:active,.tb-pill>button:active,.ed-head:active,.m-btns button:active{background:var(--surface2)}
  .pbtn:active,.banner:active{opacity:.8}
}

/* 관계도 아래 막대: 가운데 정렬하되 좁은 화면(아이폰 SE 1세대 320px)에서 넘치면 왼쪽부터 보이고 옆으로 밀 수 있게 (가운데 정렬은 양쪽이 잘림) */
.cv-bar>:first-child{margin-left:auto}.cv-bar>:last-child{margin-right:auto}
@media (max-width:350px){.cv-bar{gap:4px;padding-left:4px;padding-right:4px}.cv-bar button{padding:0 8px;gap:4px}}

/* ---- 5팀 보기·글자 고침 (10-17) ---- */
/* 낱말 중간에서 줄바꿈하지 않게 (암 / 호를, 있어 / 요). 본문 글은 그대로 */
body{word-break:keep-all;overflow-wrap:anywhere}
.ed-body,textarea,input{word-break:normal}
/* 띄어쓰기 없는 긴 제목도 시트 머리말 안에서 줄바꿈 */
.sh-head .h,.sh-head .s{overflow-wrap:anywhere;min-width:0}
/* 검색 안내 아이콘 가운데 */
.empty svg{margin:0 auto}
/* 사진 막대: 한 줄로, 넘치면 옆으로 밀기 */
.pop.pop-img{flex-wrap:nowrap;overflow-x:auto;max-width:calc(100vw - 24px);scrollbar-width:none}
.pop.pop-img>*{flex:none}
/* 본문 설정 색 견본: 화면 밖으로 숨지 않게 여러 줄로, 어두운 견본도 테두리로 보이게 */
.swatches{flex-wrap:wrap;overflow-x:visible}
.swatches button{box-shadow:inset 0 0 0 1px rgba(0,0,0,.12),0 0 0 1px var(--line)}
/* 본문 설정 미리보기: 아래가 줄 중간에서 뚝 끊기지 않게 흐리게 */
.bs-preview .preview{-webkit-mask-image:linear-gradient(#000 75%,transparent);mask-image:linear-gradient(#000 75%,transparent)}
/* 좁은 화면(320px) 폴더 머리글: 줄여 쓰지 않고 두 줄로 */
@media (max-width:350px){.fhead .s{white-space:normal}}
.bx-meta .nb{white-space:nowrap}
/* 창·키보드가 떠 있을 때 알림은 위쪽에 */
.toast.top{bottom:auto;top:calc(12px + env(safe-area-inset-top));transform:translate(-50%,-20px)}
.toast.top.show{transform:translate(-50%,0)}
/* 다크 화면: 형광펜 위 글자와 검정 글자가 보이게 */
html[data-theme="dark"] .ed-body [style*="background-color"]:not([style*="transparent"]),html[data-theme="dark"] .ed-body mark{color:#1C1C1A!important}
html[data-theme="dark"] .ed-body [style*="color: rgb(28, 28, 26)"],html[data-theme="dark"] .ed-body [style*="color: rgb(74, 74, 72)"],html[data-theme="dark"] .ed-body font[color="#1c1c1a"],html[data-theme="dark"] .ed-body font[color="#4a4a48"]{color:var(--text)!important}
@media (prefers-color-scheme:dark){
  html:not([data-theme]) .ed-body [style*="background-color"]:not([style*="transparent"]),html:not([data-theme]) .ed-body mark{color:#1C1C1A!important}
  html:not([data-theme]) .ed-body [style*="color: rgb(28, 28, 26)"],html:not([data-theme]) .ed-body [style*="color: rgb(74, 74, 72)"],html:not([data-theme]) .ed-body font[color="#1c1c1a"],html:not([data-theme]) .ed-body font[color="#4a4a48"]{color:var(--text)!important}
}

/* 2팀 5명 점검 시안 1: 누르는 곳은 가로·세로 44 이상. 보이는 크기는 그대로 두고 투명한 ::after로 누르는 곳만 넓힘 */
.bigtabs button,.grip,.lk-emo,.ep-add,.arc-add,.bp-more,.txtbtn,.doc-chip,.cmp-send,.ed-memos,.note-ex,.swatches button{position:relative}
.bigtabs button::after,.grip::after,.lk-emo::after,.ep-add::after,.arc-add::after,.bp-more::after,.txtbtn::after,.doc-chip::after,.cmp-send::after,.ed-memos::after,.note-ex::after,.swatches button::after{content:'';position:absolute;left:50%;top:50%;width:max(100%,44px);height:max(100%,44px);transform:translate(-50%,-50%)}
.ep-add,.arc-add{min-width:110px} /* '+ 에피소드'·'+ 챕터': 왼쪽 여백 포함 가로 110 이상 */
.tb-pill>button{min-width:44px;height:44px}
.ne-bar{min-height:56px}
.ne-bar button{min-height:44px}
.ne-bar .ne-more,.ne-bar [data-act="de-more"]{min-width:44px;justify-content:center}
/* 2팀 시안 5: 글자 크기 6개씩·글꼴 3개씩 두 줄, ‹는 왼쪽에 두 줄 높이로 */
#tbPanel.grid{display:grid;gap:4px;overflow:visible;grid-auto-rows:44px}
#tbPanel.grid[data-k="size"]{grid-template-columns:44px repeat(6,1fr)}
#tbPanel.grid[data-k="font"]{grid-template-columns:44px repeat(3,1fr)}
#tbPanel.grid>button{width:auto;min-width:0;height:44px;padding:0 4px}
#tbPanel.grid>[data-tb="aaBack"]{grid-row:span 2}
#tbPanel.grid>button.on{background:var(--ink);color:var(--onink)}
#world.tiny .eg:not(.sel) .lb,#world.tiny .eg:not(.sel) .lbg{display:none}
/* 2팀 시안 8: 창 닫기 */
.sh-x{position:absolute;top:8px;right:8px;width:44px;height:44px;display:grid;place-items:center;color:var(--muted);z-index:1}
.sh-x svg{width:20px;height:20px}
.sh-cancel{justify-content:center;min-height:48px;font-weight:600;color:var(--muted)}
.lk-emo.off{opacity:.4} /* 2팀 시안 11: 연결 없는 줄은 흐리게 */
/* 플롯 연결·⠿: 보이는 아이콘은 가깝게, 누르는 곳 44는 오른쪽 여백까지 넓혀 글자 칸을 덜 좁힘 (2팀 확인) */
.lk-emo{width:36px;margin-right:-8px} /* 옆 ⠿와 붙여 둠 (줄 간격 gap 상쇄) */
.lk-emo::after{left:-8px;width:44px;transform:translateY(-50%)} /* 글자와의 틈까지 누르는 곳 */
.pl-grip{width:28px;display:grid;place-items:center;padding:0;position:relative}
.pl-grip::after{content:'';position:absolute;left:0;right:-16px;top:50%;height:44px;transform:translateY(-50%)} /* 오른쪽 여백까지 누르는 곳 */
.ep{padding:10px 0} /* 줄마다 누르는 곳 44가 겹치지 않게 */
.ne-bar{gap:2px;padding:6px}
.ne-bar button{white-space:nowrap;padding:0 7px}
.ne-bar .ne-n{white-space:nowrap;min-width:0;overflow:hidden;text-overflow:ellipsis}

.cv-bar button.lk-edit{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--line)} /* 보20: 풀린 상태는 테두리 버튼 (2팀) */

/* 계정·동기화 (2팀 골격 시안) */
.sy-pad{padding:8px 24px 40px}
.sy-h{font-size:calc(22px * var(--uk,1));font-weight:700;margin:18px 0 8px}
.sy-p{color:var(--muted);font-size:calc(14.5px * var(--uk,1));line-height:1.6;margin:0 0 18px}
.sy-box{background:var(--surface);border-radius:14px;padding:14px 16px;font-size:calc(13.5px * var(--uk,1));line-height:1.65;color:var(--text);margin:14px 0 18px}
.sy-box b{display:block}.sy-box b.in{display:inline}
.sy-btn{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:48px;border-radius:12px;border:1px solid transparent;font-size:15px;font-weight:600;margin-top:8px}
.sy-btn>svg{position:absolute;left:18px;top:50%;width:20px;height:20px;margin-top:-10px}
.sy-btn.apple{background:#000;color:#fff} /* 2팀 시안: 회사 버튼 색은 어두운 화면에서도 그대로 */
.sy-btn.google{background:#fff;color:#1F1F1F;border-color:#747775}
:root[data-theme="dark"] .sy-btn.google{border-color:#8E918F}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .sy-btn.google{border-color:#8E918F}}
.sy-btn:disabled,.sy-mail:disabled{opacity:.5}
.sy-btn.spin{opacity:1}.sy-btn.spin>*{visibility:hidden}
.sy-btn.spin::after{content:'';position:absolute;left:50%;top:50%;width:20px;height:20px;margin:-10px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:sySpin .8s linear infinite}
@keyframes sySpin{to{transform:rotate(360deg)}}
.sy-mail{height:44px;margin:14px auto 0;display:block;padding:0 8px;color:var(--text);font-size:calc(15px * var(--uk,1))}
.sy-pad .sy-foot{text-align:center}
.sy-foot{font-size:calc(12.5px * var(--uk,1));color:var(--muted);line-height:1.6;margin-top:18px}
.sy-input{width:100%;height:50px;border-radius:14px;border:1.5px solid var(--line);background:var(--surface);color:var(--text);padding:0 14px;font-size:16px}
.sy-err{color:var(--danger);font-size:13.5px;min-height:20px;margin:8px 2px}
.sy-code{position:relative;display:flex;gap:8px;margin-top:6px}
.sy-code span{flex:1;height:56px;border:1.5px solid var(--line);border-radius:12px;display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:600;background:var(--surface)}
.sy-code span.cur{border-color:var(--ink)}
.sy-code input{position:absolute;inset:0;opacity:0;font-size:16px;caret-color:transparent}
.sy-link{display:block;margin:6px 4px;padding:8px 0;color:var(--link);font-size:calc(14px * var(--uk,1));text-decoration:underline;background:none}
.sy-link:disabled{color:var(--muted);text-decoration:none}
.group .item.sy-two>span:not(.toggle){display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
.group .item.sy-two small{font-size:calc(12.5px * var(--uk,1));color:var(--muted)}
.group .item.sy-two small.bad{color:var(--danger)}
.sy-del{margin-top:40px}.sy-del b{color:var(--danger);font-weight:500}
.sy-band{background:var(--surface);color:var(--muted);border-radius:12px;padding:10px 14px;font-size:13.5px;line-height:1.6;margin:10px 0 4px}
.dr-acct [data-syncline].bad{color:var(--danger)}
