/* Comments sheet: a dialog on wide screens, a bottom sheet on phones. */
html.cm-lock{overflow:hidden;}
.cm-sheet{position:fixed; inset:0; z-index:250; display:flex; align-items:flex-end; justify-content:center;}
.cm-sheet[hidden]{display:none;}
.cm-back{position:absolute; inset:0; background:rgba(0,0,0,.6);}
.cm-panel{position:relative; display:flex; flex-direction:column; width:100%; height:92vh; height:92dvh; background:var(--white); color:var(--navy); border-radius:20px 20px 0 0; box-shadow:0 -10px 40px rgba(0,0,0,.4); outline:0; overflow:hidden; animation:cm-up .22s ease-out;}
@keyframes cm-up{from{transform:translateY(30px); opacity:0;}to{transform:none; opacity:1;}}
@media (prefers-reduced-motion:reduce){.cm-panel{animation:none;}}
@media (min-width:721px){
  .cm-sheet{align-items:center;}
  .cm-panel{width:min(640px,94vw); height:min(86vh,760px); border-radius:20px;}
}
.cm-head{display:flex; align-items:center; justify-content:space-between; padding:14px 16px 6px 18px; flex:none;}
.cm-head h2{margin:0; font:700 18px/1.2 'Sora','Inter',sans-serif; color:var(--navy);}
.cm-x{width:36px; height:36px; border-radius:50%; border:0; background:color-mix(in srgb, var(--navy) 8%, transparent); color:var(--navy); display:grid; place-items:center; cursor:pointer;}
.cm-x:hover{background:color-mix(in srgb, var(--navy) 16%, transparent);}
.cm-x:focus-visible,.cm-sort:focus-visible,.cm-act:focus-visible,.cm-send:focus-visible,.cm-more:focus-visible{outline:2px solid var(--blue); outline-offset:2px;}
.cm-sorts{display:flex; gap:6px; padding:4px 16px 10px; flex:none; overflow-x:auto;}
.cm-sort{border:1.5px solid var(--border-soft); background:transparent; color:var(--navy-soft); border-radius:999px; padding:6px 13px; font:600 13px/1 'Inter',sans-serif; cursor:pointer; white-space:nowrap;}
.cm-sort.is-on{background:var(--blue); border-color:var(--blue); color:#fff;}

.cm-list{flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:4px 16px 12px; border-top:1px solid var(--border-soft);}
.cm-items{display:flex; flex-direction:column; gap:14px; padding-top:12px;}
.cm-empty{text-align:center; color:var(--navy-soft); padding:40px 10px; margin:0;}
.cm-loading{display:flex; justify-content:center; padding:18px; margin:0;}
.cm-loading[hidden],.cm-more[hidden],.cm-empty[hidden],.cm-compose[hidden]{display:none;}
.cm-spin{width:22px; height:22px; border-radius:50%; border:3px solid var(--border-soft); border-top-color:var(--blue); animation:cm-spin .8s linear infinite;}
@keyframes cm-spin{to{transform:rotate(360deg);}}
.cm-more{display:block; margin:14px auto 4px; border:1.5px solid var(--border-soft); background:transparent; color:var(--navy); font:600 14px/1 'Inter',sans-serif; padding:11px 18px; border-radius:12px; cursor:pointer;}
.cm-more:hover{background:var(--blue-tint);}

/* one comment */
.cm{display:flex; gap:10px; align-items:flex-start;}
.cm-av{width:36px; height:36px; font-size:14px; flex:none;}
.cm.is-reply .cm-av{width:28px; height:28px; font-size:12px;}
.cm-main{flex:1; min-width:0;}
.cm-bubble{position:relative; display:inline-block; max-width:100%; background:color-mix(in srgb, var(--navy) 7%, transparent); border-radius:16px; padding:8px 13px 9px;}
.cm-bubble:has(.cm-rsum){margin-bottom:10px;}
.cm-top{display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-bottom:2px;}
.cm-top b{font:700 13.5px/1.3 'Inter',sans-serif; color:var(--navy);}
.cm-badge{font:700 10px/1 'JetBrains Mono',monospace; text-transform:uppercase; letter-spacing:.4px; padding:4px 7px; border-radius:999px; background:var(--blue-tint); color:var(--blue-dark);}
.cm-badge.is-author{background:var(--mint-tint); color:var(--teal);}
.cm-content{position:relative;}
.cm-body{white-space:pre-wrap; overflow-wrap:anywhere; font:400 14.5px/1.55 'Inter',sans-serif; color:var(--navy);}
html[lang="ar"] .cm-body{font-family:'Noto Sans Arabic','Inter',sans-serif; line-height:1.8;}
html[lang="ja"] .cm-body{font-family:'Noto Sans JP','Inter',sans-serif;}
.cm-photo{display:block; max-width:100%; max-height:300px; border-radius:12px; margin-top:6px; object-fit:contain;}
.cm-content.is-spoiler{min-height:56px; min-width:150px;}
.cm-content.is-spoiler > :not(.fp-reveal){filter:blur(10px); pointer-events:none; user-select:none;}
.cm-content.is-spoiler.is-shown > :not(.fp-reveal){filter:none; pointer-events:auto; user-select:auto;}
.cm-content.is-spoiler.is-shown .fp-reveal{display:none;}
.cm-reveal{border-radius:10px;}
.cm-reveal span{font-size:13px;}
.cm-reveal small{font-size:11.5px;}
.cm-rsum{position:absolute; inset-inline-end:8px; bottom:-11px; display:inline-flex; align-items:center; gap:5px; background:var(--white); border:1px solid var(--border-soft); border-radius:999px; padding:2px 7px 2px 3px; font-size:12px; color:var(--navy-soft); box-shadow:0 1px 4px rgba(0,0,0,.18);}
html[dir="rtl"] .cm-rsum{padding:2px 3px 2px 7px;}
.cm-rsum b{font-weight:600;}
.cm-rsum .rx.sm{--s:16px;}
.cm-rsum .fp-rstack .rx{box-shadow:inset 0 0 0 calc(var(--s) * .03) rgb(38 20 10 / .55), 0 0 0 1.5px var(--white);}

.cm-meta{display:flex; align-items:center; gap:4px; flex-wrap:wrap; padding:3px 6px 0; font-size:12.5px; color:var(--navy-soft);}
.cm-meta time{margin-inline-end:6px;}
.cm-react{position:relative; display:inline-flex;}
.cm-act{border:0; background:transparent; color:var(--navy-soft); font:700 12.5px/1 'Inter',sans-serif; padding:6px 8px; border-radius:8px; cursor:pointer;}
.cm-act:hover{background:var(--blue-tint); color:var(--navy);}
.cm-act:disabled{opacity:.55; cursor:wait;}
.cm-like.is-on{color:var(--rx);}
.cm-like.is-on.rb-3,.cm-like.is-on.rb-4,.cm-like.is-on.rb-8{color:color-mix(in srgb, var(--rx) 82%, var(--navy));}
.cm-toggle{display:block; margin:4px 0 0; padding:6px 6px; color:var(--blue-dark);}
.cm-replies{display:flex; flex-direction:column; gap:12px; margin-top:8px;}
.cm-replies[hidden]{display:none;}
.cm-replies .cm-loading{padding:8px;}
.cm-more-r{align-self:flex-start; color:var(--blue-dark);}

/* the reactions popup: fixed so the scrolling list never clips it */
.cm-sheet .fp-picker{position:fixed; z-index:260; inset-inline:auto; justify-content:flex-start; gap:4px; padding:7px;}
.cm-sheet .fp-picker[hidden]{display:none;}
@media (max-width:520px){
  .cm-sheet .fp-picker{gap:0; padding:6px; justify-content:space-between;}
  .cm-sheet .fp-picker .rx.lg{--s:clamp(24px, 7.8vw, 34px);}
}

/* the writing box */
.cm-compose{flex:none; padding:10px 14px calc(12px + env(safe-area-inset-bottom)); border-top:1px solid var(--border-soft); background:var(--white);}
.cm-chip{display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; padding:6px 6px 6px 12px; border-radius:10px; background:var(--blue-tint); color:var(--blue-dark); font:600 13px/1.3 'Inter',sans-serif;}
.cm-chip[hidden]{display:none;}
.cm-chip-x{border:0; background:transparent; color:inherit; font-size:20px; line-height:1; padding:2px 8px; cursor:pointer; border-radius:8px;}
.cm-row{display:flex; gap:8px; align-items:flex-end;}
.cm-input{flex:1; min-width:0; resize:none; border:1.5px solid var(--border-soft); border-radius:14px; background:color-mix(in srgb, var(--navy) 5%, transparent); color:var(--navy); font:400 15px/1.45 'Inter',sans-serif; padding:10px 13px; max-height:140px;}
html[lang="ar"] .cm-input{font-family:'Noto Sans Arabic','Inter',sans-serif;}
.cm-input:focus{outline:0; border-color:var(--blue);}
.cm-send{border:0; background:var(--blue); color:#fff; font:700 14px/1 'Inter',sans-serif; padding:12px 18px; border-radius:12px; cursor:pointer; flex:none;}
.cm-send:disabled{opacity:.55; cursor:wait;}
.cm-spoiler{display:inline-flex; align-items:center; gap:6px; margin-top:8px; font:600 12.5px/1 'Inter',sans-serif; color:var(--navy-soft); cursor:pointer;}
.cm-spoiler input{width:16px; height:16px; accent-color:var(--blue);}
.cm-signin{display:block; text-align:center; font:700 14px/1 'Inter',sans-serif; color:var(--blue-dark); padding:12px; border-radius:12px; background:var(--blue-tint); text-decoration:none;}
.cm-note{margin:0; text-align:center; color:var(--navy-soft); font-size:13.5px;}

.cm-toast{position:fixed; left:50%; bottom:24px; transform:translate(-50%,20px); opacity:0; z-index:300; max-width:min(92vw,420px); background:#0E1B2E; color:#fff; padding:12px 18px; border-radius:12px; font:600 14px/1.4 'Inter',sans-serif; box-shadow:0 10px 30px rgba(0,0,0,.35); transition:opacity .25s, transform .25s; text-align:center;}
.cm-toast.is-in{opacity:1; transform:translate(-50%,0);}
