:root {
  color-scheme: dark;
  --bg: #0e1020;
  --nav: #111324;
  --panel: #181b2f;
  --panel-deep: #13162a;
  --line: #2a2e47;
  --text: #f7f2ef;
  --muted: #a7aec8;
  --accent: #f2b9cb;
  --lilac: #c9bcff;
  --danger: #fda9af;
  --radius: 17px;
  --font: Inter, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); }
a { color: var(--lilac); text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, .button, .btn {
  display: inline-flex; gap: .45rem; align-items: center; justify-content: center;
  border: 1px solid var(--line); background: #222640; color: var(--text); padding: .56rem .95rem;
  min-height: 42px; border-radius: 10px; cursor: pointer; font-weight: 600; line-height: 1.35;
  text-decoration: none; touch-action: manipulation;
}
button:hover, .button:hover, .btn:hover { background: #303453; color: var(--text); border-color: #454964; }
button.primary, .button.primary, .btn.primary { color: #281a2c; border-color: transparent; background: var(--accent); }
button.primary:hover, .button.primary:hover, .btn.primary:hover { background: #ffd5e2; color: #291a2b; }
button.ghost, .button.ghost { background: transparent; }
button.danger, .button.danger { color: var(--danger); }
button:disabled, input:disabled { opacity: .48; cursor: not-allowed; }
input, textarea, select {
  min-width: 0; padding: .65rem .75rem; border: 1px solid #343953; border-radius: 9px;
  background: #111426; color: var(--text); line-height: 1.4;
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #8c94ad; }
textarea { width: 100%; resize: vertical; }
label { display: grid; gap: .35rem; font-size: .91rem; color: #d7d9e8; }
label.check { display: flex; align-items: center; gap: .55rem; }
h1,h2,h3,p { margin-top: 0; }
h1,h2,h3 { line-height: 1.26; }
h1 { margin-bottom: .5rem; font-size: clamp(2rem,4vw,3rem); font-weight: 730; letter-spacing: -.025em; }
h2 { font-size: 1.25rem; margin-bottom: .75rem; }
h3 { font-size: 1.07rem; margin-bottom: .3rem; }
p { margin-bottom: .7rem; }
img, video { max-width: 100%; }
:focus-visible { outline: 2px solid #f8c3d5; outline-offset: 3px; }
.skip { position: fixed; top: .5rem; left: .5rem; z-index: 20; padding: 1rem; background: var(--panel); transform: translateY(-160%); }
.skip:focus { transform: none; }
.loading { padding: 2rem; color: var(--muted); }
.muted, .meta, small { color: var(--muted); }
small,.meta { font-size: .86rem; }
.eyeline { color: var(--lilac); font-size: .87rem; letter-spacing: .12em; font-weight: 650; }
.row, .actions, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.split { display: flex; align-items: center; justify-content: space-between; gap: .7rem; }
.stack { display: grid; gap: 1rem; }
.two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1rem; }
.three-col { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .85rem; }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem 1rem; }
.wide { grid-column: 1 / -1; }
.shell { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 27px 15px 17px; display: flex; flex-direction: column; border-right: 1px solid #24273e; background: var(--nav); }
.brand { display: flex; align-items: center; color: var(--text); gap: .75rem; padding: 0 9px; margin-bottom: 30px; }
.brand-mark { display: inline-grid; flex: 0 0 41px; place-items: center; width: 41px; height: 41px; background: #282541; color: var(--accent); border: 1px solid #4d4269; border-radius: 12px; font-size: 1.4rem; }
.brand b { display: block; font-size: 1.07rem; }
.brand small { display: block; margin-top: -1px; color: #aaa1c1; font-size: .77rem; }
.nav-list { display: flex; flex-direction: column; gap: .3rem; overflow: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 43px; padding: .5rem .7rem; border: 1px solid transparent; border-radius: 10px; color: #bac0d7; white-space: nowrap; font-size: .93rem; }
.nav-item:hover { color: var(--text); background: #1b1e33; }
.nav-item.active { color: #fbd4de; border-color: #4a3b58; background: #2a233a; }
.nav-icon { display: inline-grid; place-items: center; width: 20px; font-size: 1.11rem; color: #c5b7f2; }
.sidebar-foot { margin-top: auto; padding: .75rem .4rem 0; border-top: 1px solid #272a41; }
.workspace { min-width: 0; }
.topbar { display: flex; position: relative; z-index: 3; align-items: center; justify-content: space-between; min-height: 65px; padding: .7rem clamp(16px,4vw,48px); border-bottom: 1px solid #24273e; background: #101222; }
.crumbs { color: #cbcbe0; font-size: .93rem; }
.global-search { display: flex; align-items: center; gap: .6rem; }
.global-search input { width: min(30vw,250px); font-size: .9rem; }
.top-actions { display: flex; align-items: center; gap: .65rem; }
.icon-button { min-width: 42px; padding: .48rem .6rem; position: relative; }
.count { display: inline-grid; place-items: center; min-width: 1.25rem; min-height: 1.25rem; padding-inline: .25rem; color: #241a2d; background: var(--accent); border-radius: 20px; font-size: .72rem; }
.content { max-width: 1400px; margin: 0 auto; padding: 30px clamp(16px,4vw,48px) 55px; }
.pagehead { margin-bottom: 23px; }
.pagehead p { margin: 0; color: var(--muted); }
.card, .panel, .empty {
  display: block; min-width: 0; padding: 1.15rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.panel + .panel { margin-top: 1rem; }
.empty { color: var(--muted); padding: 1.35rem; border-style: dashed; background: #15182a; }
.empty p:last-child, .card p:last-child { margin-bottom: 0; }
.section-title { margin: 0 0 .75rem; }
.pill { display: inline-flex; border-radius: 999px; padding: .23rem .65rem; border: 1px solid #3e4161; color: #d8d1ee; background: #232640; font-size: .85rem; }
.avatar { width: 43px; height: 43px; background: #303451; color: #ded1ff; border: 1px solid #4a4b70; border-radius: 999px; flex: 0 0 auto; display: inline-grid; place-items: center; font-weight: 700; object-fit: cover; }
.avatar.daidai { background: #492e45; color: #ffd7e1; border-color: #754c68; }
.avatar.tiny { width: 29px; height: 29px; font-size: .82rem; }
.hero { position: relative; display: grid; isolation: isolate; overflow: hidden; min-height: 303px; padding: clamp(25px,4.2vw,55px); border: 1px solid #464266; border-radius: 23px; background: radial-gradient(ellipse at 75% 39%, #76476973 0, transparent 53%), radial-gradient(ellipse at 72% 80%, #46386b 0, transparent 61%), linear-gradient(116deg,#17182b 10%,#282442 55%,#191d38 100%); }
.hero .eyeline { margin-bottom: 16px; }
.hero h1 { margin: 0 0 13px; font-family: "Noto Serif SC","Songti SC","SimSun",serif; font-size: clamp(2.55rem,4.7vw,5.25rem); color: #fff7f2; font-weight: 730; }
.hero h1 span { color: #edb3cb; font-size: .6em; display: inline-block; vertical-align: .13em; margin: 0 .19em; }
.hero-copy { position: relative; z-index: 1; align-self: center; }
.hero-copy p:not(.eyeline) { color: #dfcfe3; }
.hero .actions { margin-top: 21px; }
.orbit { position: absolute; z-index: 0; pointer-events: none; inset: 0; overflow: hidden; opacity: .92; mask-image: linear-gradient(to right,transparent 25%,#000 50%); }
.orbit::before { content:""; position: absolute; inset: 0; background-size: 31% 67%, 48% 51%, 42% 77%; background-image: radial-gradient(1.3px at 70% 22%,#fff5ee 90%,transparent), radial-gradient(1px at 15% 35%,#d1c5ff 90%,transparent), radial-gradient(1.7px at 40% 74%,#f2bdd8 90%,transparent); }
.orbit::after { content:""; position: absolute; width: clamp(130px,22vw,365px); aspect-ratio: 1; border-radius: 50%; left: 67%; top: -15%; background: radial-gradient(circle at 48% 51%, transparent 58%,#eac3df42 59%,transparent 66%), radial-gradient(circle at 40% 51%,#eeb8d415 0%,#d3a6e411 55%,transparent 72%); box-shadow: 0 0 70px #eda5d228; border: 1px solid #efd6ef30; }
.orbital-ring,.orbital-ring:nth-child(2) { border: 1px solid #f7d8f153; width: 430px; height: 170px; border-radius: 50%; position: absolute; right: -40px; top: 31%; transform: rotate(-28deg); box-shadow: 0 0 27px #dcaef52a; }
.orbital-ring:nth-child(2) { right: 3%; top: 20%; transform: rotate(23deg); opacity:.5; }
.star { position:absolute; color:#ffe7f1; font-size: 38px; text-shadow: 0 0 17px #e9b9ee; top: 28%; right: 23%; }
.star.alt { font-size: 22px; top: 69%; right: 11%; color:#ddd1ff; }
.hero + section { margin-top: 1.05rem; }
.person-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .7rem; }
.person-card h2 { margin: 0; }
.person-card .clock { font-variant-numeric: tabular-nums; align-self: start; color: #e6cef4; font-weight: 700; }
.dashboard-section { margin-top: 1.5rem; }
.counter { min-height: 120px; }
.counter p { font-size: 1.6rem; font-weight: 720; line-height: 1.25; margin: .35rem 0 0; color: #f7d0de; }
.counter .counter-link { display: block; width: fit-content; margin-top: .35rem; }
.counter p a { color: inherit; }
.counter p a:hover { color: #ffe8f0; }
.counter-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(150px,45%),1fr)); gap: .75rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(126px,1fr)); gap: .65rem; }
.quick-grid a { min-height: 52px; background: #1a1d32; color: var(--text); }
.quick-grid a:hover { background: #2b2541; }
.recent-card { color: var(--text); }
.recent-card:hover { border-color: #5e5277; color: var(--text); }
.timeline-list { padding: 0 0 0 1.16rem; border-left: 1px solid #5b4b73; display: grid; gap: .85rem; margin: 1rem 0 0 .4rem; }
.timeline-list .card { position: relative; }
.timeline-list .card::before { position: absolute; content:""; left: -1.44rem; top: 1.25rem; width: .44rem; height: .44rem; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px var(--bg); }
.tabbar { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.tabbar a { font-size: .91rem; padding: .55rem .85rem; border: 1px solid var(--line); border-radius: 10px; color: #c8c8dd; }
.tabbar a.active { background: #2d243b; color: #f9d1df; border-color: #5c4867; }
details > summary { cursor: pointer; color: var(--lilac); }
blockquote { padding: .45rem 0 .45rem .8rem; margin: .7rem 0; border-left: 2px solid #5f5179; color: #ddcedd; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.error-text { color: var(--danger); }
#toast:empty { display: none; }
#toast { position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 30; max-width: min(92vw,26rem); padding: .8rem 1rem; background: #29233a; color: var(--text); border: 1px solid #675574; border-radius: 12px; box-shadow: 0 6px 24px #0005; }
#toast.error { border-color: #a35b73; }
.signin-page { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(350px,.88fr); min-height: 100vh; }
.signin-visual { position: relative; isolation: isolate; overflow: hidden; display: flex; min-height: 390px; flex-direction: column; padding: clamp(1.4rem,5vw,4.3rem); background: radial-gradient(ellipse at 20% 65%, #62507b,transparent 65%), radial-gradient(ellipse at 80% 34%,#6b425d 0%,#2d2848 49%,#15182b 90%); }
.signin-visual .brand { margin: 0; padding: 0; }
.signin-visual .orbit { opacity: .8; mask-image: linear-gradient(to top,transparent,#000 20%); }
.signin-visual .orbit::after { left: 45%; top: 9%; width: min(32vw,460px); }
.signin-visual h1 { font-family: "Noto Serif SC","Songti SC","SimSun",serif; font-size: clamp(3rem,6.5vw,7.3rem); margin: .2rem 0 .85rem; color: #fff5f5; }
.signin-copy { position: relative; z-index: 1; margin: auto 0; }
.signin-copy p { color: #edd9ea; }
.signin-panel { display: grid; place-items: center; padding: 2rem; }
.signin-card { width: min(100%,410px); }
.signin-card .brand-mark { margin-bottom: 1rem; }
.signin-card h2 { font-size: 1.95rem; }
.signin-card .action-links { display: flex; flex-wrap: wrap; gap: .75rem; }
.signin-card .action-links button { min-height: 32px; border: 0; padding: 0 .2rem; background: transparent; color: var(--lilac); }
.signin-card form { margin: 1rem 0; }
.signin-card form button { width: 100%; }
.mobile-menu { display: none; }
@media (max-width: 1000px) {
  .shell { grid-template-columns: 177px minmax(0,1fr); }
  .sidebar { padding-inline: 9px; }
  .wide-desktop { display:none; }
}
@media (max-width: 760px) {
  .shell { display:block; }
  .sidebar { display:none; position: fixed; z-index: 10; inset: 0 auto 0 0; height: 100dvh; width: min(82vw,252px); box-shadow: 0 0 0 200vw #090a15aa; padding: 20px 14px; }
  .shell.menu-open .sidebar { display:flex; }
  .mobile-menu { display: inline-flex; }
  .topbar { padding: .65rem 14px; min-height: 57px; gap: .3rem; }
  .global-search input { width: min(42vw,220px); }
  .content { padding-top: 21px; }
  .crumbs .crumb-name { display: none; }
  .hero { min-height: 244px; }
  .orbit { opacity: .55; }
  .orbital-ring,.orbital-ring:nth-child(2) { width: 280px; right: -60px; }
  .signin-page { display:block; }
  .signin-visual { min-height: 250px; }
  .signin-copy { margin: 1.2rem 0 0; }
  .signin-panel { padding: 1.35rem; }
}
@media (max-width: 470px) {
  .fields,.two-col,.three-col { grid-template-columns: 1fr; }
  .signin-visual { min-height: 220px; }
  .person-card { padding: .85rem; }
  .dashboard-section .three-col { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }

.remote-account-select { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.remote-login { min-height: 100svh; }
.remote-login .signin-visual { padding-inline: max(clamp(1.4rem,5vw,4.3rem), env(safe-area-inset-left), env(safe-area-inset-right)); }
.remote-login .signin-copy p { margin-bottom: 0; max-width: 32em; line-height: 1.65; text-wrap: pretty; }
.remote-login .signin-card { padding: clamp(1.15rem, 3.2vw, 2rem); border: 1px solid #34354e; border-radius: var(--radius); background: linear-gradient(160deg,#201e35,var(--panel-deep) 82%); box-shadow: 0 16px 54px #05061155; }
.remote-login .signin-card .brand-mark { margin-bottom: .85rem; }
.remote-login .signin-card h2 { margin-bottom: .45rem; }
.remote-login .signin-card form { margin-bottom: 0; }
.remote-login #password, .remote-login #sign-in { min-height: 46px; }
.remote-login #password { width: 100%; font-size: 1rem; }
.remote-login .error-text { margin: 0; }
.remote-account-select legend { padding: 0 0 .4rem; color: var(--muted); font-size: .91rem; }
.account-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.account-choice { position: relative; min-width: 0; }
.account-choice input[type=radio] { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; clip-path: inset(50%); }
.account-choice input[type=radio] + span { display: flex; align-items: center; justify-content: space-between; gap: .4rem; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-deep); color: var(--text); cursor: pointer; font-size: 1rem; font-weight: 650; }
.account-choice input[type=radio] + span::after { content: ""; width: .9rem; height: .9rem; flex: 0 0 auto; border: 1px solid var(--muted); border-radius: 50%; }
.account-choice:hover input[type=radio] + span { border-color: var(--lilac); }
.account-choice input[type=radio]:checked + span { border-color: var(--accent); background: #2a233a; }
.account-choice input[type=radio]:checked + span::after { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #2a233a; }
.account-choice input[type=radio]:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.account-choice input[type=radio]:disabled + span { opacity: .48; cursor: not-allowed; }

.sidebar-heading .brand { margin-bottom: 1.5rem; }
.nav-dismiss, .nav-backdrop { display: none; }
.topbar :is(button, .button) { min-width: 44px; min-height: 44px; }
.change-shortcut { flex-shrink: 0; }
.change-shortcut .count { position: absolute; inset: .1rem .1rem auto auto; }
.hero .actions :is(button, .button) { min-height: 46px; }
#home .hero-copy > p:not(.eyeline) { max-width: 24em; }
#home .person-card { background: linear-gradient(115deg,#1d2036,var(--panel) 64%); }
#home .person-card > div { min-width: 0; overflow-wrap: anywhere; }
#home .counter-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
#home .counter { overflow-wrap: anywhere; }
#home .counter small:first-child { color: #c5c6db; }
#home .recent-card { display: grid; align-content: start; gap: .28rem; overflow-wrap: anywhere; }
#home .recent-card :is(h3,p) { margin: 0; }
.quick-grid button span { color: var(--lilac); font-size: 1.125em; line-height: 1.1; }
.remote-filter { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(0, 1fr)); gap: .7rem; align-items: end; }
.remote-filter :is(#query, #type, #author, #group, #chat-order) { width: 100%; }
.remote-list-head :is(h1, h2), .remote-list-head p { margin: 0; }
.remote-reader .results, .remote-reader .group { display: grid; gap: .7rem; }
.remote-reader .group h3 { margin: .35rem 0 0; }
.quick-grid button { min-height: 52px; background: #1a1d32; color: var(--text); }
.quick-grid button:hover { background: #2b2541; }
#gate p:empty, .remote-sync p:empty { display: none; }
body:has(.shell:not([hidden])) > #gate { position: fixed; inset: auto 0 0; z-index: 20; pointer-events: none; }
body:has(.shell:not([hidden])) > #gate .remote-gate { width: fit-content; margin-inline: auto; pointer-events: auto; }
.remote-entry { min-width: 0; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-deep); overflow-wrap: anywhere; }
.remote-entry :is(h3, h4) { margin: 0 0 .35rem; }
:is(.remote-entry, .remote-change-list) .entry-meta { display: flex; flex-wrap: wrap; gap: .2rem .65rem; color: var(--muted); font-size: .86rem; }
.remote-entry p { margin: .35rem 0 0; white-space: pre-wrap; }
:is(.remote-entry, .remote-change-list) summary { color: var(--lilac); cursor: pointer; }
.remote-sync { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .7rem; }
.remote-change-list { display: grid; gap: .65rem; min-width: 0; overflow-wrap: anywhere; }
.remote-paging { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .55rem .75rem; }
.remote-editor { width: min(100% - 2rem, 34rem); max-height: calc(100% - 2rem); padding: 1.25rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); }
.remote-editor::backdrop { background: #090a15aa; }
.remote-editor .stack { gap: .75rem; }
.remote-editor .actions { margin-top: .25rem; }

@media (max-width: 760px) {
  .remote-login .signin-visual { min-height: 205px; padding-block-start: max(1.2rem, env(safe-area-inset-top)); }
  .remote-login .signin-visual h1 { margin-bottom: .5rem; font-size: clamp(2.4rem, 9.5vw, 4rem); }
  .remote-login .signin-panel { padding: 1rem max(1rem,env(safe-area-inset-left),env(safe-area-inset-right)) max(1rem,env(safe-area-inset-bottom)); }
  .remote-login .signin-card > .brand-mark { display: none; }
  .topbar { position: sticky; top: 0; padding-block-start: max(.45rem,env(safe-area-inset-top)); padding-block-end: .45rem; }
  .topbar, .workspace .content { padding-inline: max(1rem,env(safe-area-inset-left),env(safe-area-inset-right)); }
  .top-actions, .global-search { min-width: 0; gap: .35rem; }
  .top-actions { flex: 1; justify-content: flex-end; }
  .global-search { flex: 1; max-width: 26rem; }
  .global-search input { flex: 1; width: 0; min-height: 44px; font-size: 1rem; }
  .shell .sidebar { box-shadow: 10px 0 32px #08091580; padding-block: max(1rem,env(safe-area-inset-top)) max(1rem,env(safe-area-inset-bottom)); }
  .sidebar-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: .3rem; }
  .sidebar-heading .brand { padding-inline: 0; gap: .55rem; }
  .sidebar-heading .nav-dismiss { display: inline-flex; min-width: 44px; min-height: 44px; padding: .3rem; font-size: 1.32rem; }
  .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 9; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; }
  .nav-backdrop, .nav-backdrop:hover { background: #070813b8; }
  body:has(.shell.menu-open) { overflow: hidden; }
  #home .counter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  #home .counter { min-height: 99px; padding: .8rem; }
  #home .hero { min-height: 0; padding: clamp(1.25rem,5.5vw,2rem); }
  #home .hero .eyeline { margin-bottom: .52rem; }
  #home .hero h1 { margin-bottom: .55rem; }
  #home .hero .actions { margin-top: 1rem; gap: .5rem; }
  #home .hero .actions > * { padding-inline: .75rem; }
  #home .dashboard-section { margin-top: 1.25rem; }
  .remote-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .remote-filter > #query, .remote-filter label:has(#query) { grid-column: 1 / -1; }
}
@media (min-width: 500px) and (max-width: 760px) {
  .crumbs .crumb-name { display: initial; white-space: nowrap; }
}
@media (max-width: 470px) {
  #home .two-col { gap: .65rem; }
  #home .quick-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: .5rem; }
  #home .quick-grid button { flex-direction: column; min-height: 58px; gap: .18rem; padding: .38rem .2rem; }
}

.remote-editor {
  overscroll-behavior: contain;
  scroll-padding-block-end: 1.25rem;
}
.remote-editor > h2 { margin: 0 0 .75rem; }
.remote-editor .stack { gap: .65rem; }
.remote-editor .error-text { margin: 0; overflow-wrap: anywhere; }
.remote-editor .edit-actions { margin-top: .15rem; }

.remote-sync { margin-block-start: 1rem; }
.remote-sync-meta { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.remote-sync-meta p { margin: 0; }
.remote-sync-meta p + p { margin-block-start: .2rem; }
.remote-sync-actions { gap: .55rem; }
.remote-sync-actions :is(button, .button), .remote-paging button { min-height: 44px; }
.remote-change-list > .card { padding: .9rem 1rem; }
.remote-change-list > .card > h3 { margin-bottom: .22rem; }
.remote-change-list .card details { margin-block-start: .4rem; }
.remote-change-list .card p { margin: .35rem 0 0; white-space: pre-wrap; }
.remote-paging { margin-block-start: 1rem; }
.remote-paging #page-of { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 530px) {
  .remote-editor {
    --editor-left: max(1rem, env(safe-area-inset-left, 0px));
    --editor-right: max(1rem, env(safe-area-inset-right, 0px));
    --editor-bottom: env(safe-area-inset-bottom, 0px);
    position: fixed;
    inset: auto 0 0;
    width: 100%;
    max-width: none;
    max-height: calc(100vh - max(.5rem, env(safe-area-inset-top, 0px)));
    max-height: calc(100dvh - max(.5rem, env(safe-area-inset-top, 0px)));
    margin: 0;
    padding: .85rem var(--editor-right) 0 var(--editor-left);
    scroll-padding-block-end: calc(4.5rem + var(--editor-bottom));
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .remote-editor > h2 { margin-block-end: .6rem; }
  .remote-editor .edit-actions {
    position: sticky;
    z-index: 1;
    bottom: 0;
    align-self: start;
    gap: .55rem;
    margin: 0 calc(-1 * var(--editor-right)) 0 calc(-1 * var(--editor-left));
    padding: .62rem var(--editor-right) calc(.65rem + var(--editor-bottom)) var(--editor-left);
    border-top: 1px solid var(--line);
    background: var(--panel);
  }
  .remote-editor .edit-actions button { min-width: 0; min-height: 46px; flex: 1 1 0; }
  .remote-editor .edit-actions .primary { flex-grow: 1.4; }
}

@media (max-width: 470px) {
  .remote-sync-actions { flex: 1 1 100%; }
  .remote-sync-actions :is(button, .button) { flex: 1 1 auto; }
  .remote-paging { column-gap: .45rem; }
  .remote-paging button { padding-inline: .65rem; }
}

#reader.remote-chat {
  --chat-incoming: #20243c;
  --chat-incoming-line: #3a4462;
  --chat-outgoing: #33263f;
  --chat-outgoing-line: #624865;
  --chat-neutral: #1b2032;
  --chat-neutral-line: #343c54;
  --chat-meta: #b7bfd8;
  --chat-width: min(78%, 42rem);
}

.remote-chat .remote-filter {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) repeat(3, minmax(0, 1fr));
  align-items: end;
}
.remote-chat .remote-filter > :not(.search-field, #author-field, #chat-media-field, #chat-order-field) {
  display: none;
}
.remote-chat .remote-filter > :is(.search-field, #author-field, #chat-media-field, #chat-order-field) {
  min-inline-size: 0;
  gap: .3rem;
}
.remote-chat .remote-filter :is(input, select) {
  inline-size: 100%;
  min-inline-size: 0;
  min-block-size: 44px;
}
.remote-chat .remote-list-head #count {
  color: var(--chat-meta);
  font-variant-numeric: tabular-nums;
}

.remote-chat .results {
  display: grid;
  min-inline-size: 0;
  gap: 1.5rem;
}
.remote-chat .results .chat-month {
  display: grid;
  min-inline-size: 0;
  gap: .95rem;
}
.remote-chat .chat-month > .chat-month-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .85rem;
  margin: .25rem 0 .45rem;
  color: var(--chat-meta);
  font-size: .9375rem;
  font-weight: 650;
  text-align: center;
}
.remote-chat .chat-month-title::before,
.remote-chat .chat-month-title::after {
  content: "";
  flex: 1 1 3rem;
  max-inline-size: 8rem;
  block-size: 1px;
  background: #39405a;
}

.remote-chat .chat-message {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: .25rem;
  min-inline-size: 0;
}
.remote-chat .chat-message.chat-mine {
  justify-items: end;
}
.remote-chat .chat-message.chat-unknown {
  justify-items: center;
}
.remote-chat .chat-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .125rem .55rem;
  max-inline-size: var(--chat-width);
  padding-inline: .2rem;
  color: var(--chat-meta);
  font-size: .875rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.remote-chat .chat-mine .chat-message-meta {
  justify-content: flex-end;
  text-align: end;
}
.remote-chat .chat-unknown .chat-message-meta {
  justify-content: center;
  text-align: center;
}
.remote-chat .chat-speaker {
  color: var(--lilac, #c9bcff);
  font-weight: 700;
}
.remote-chat .chat-mine .chat-speaker {
  color: var(--accent, #f2b9cb);
}
.remote-chat .chat-unknown .chat-speaker {
  color: var(--chat-meta);
}
.remote-chat .chat-time {
  font-variant-numeric: tabular-nums;
}

.remote-chat .chat-bubble {
  inline-size: fit-content;
  min-inline-size: 0;
  max-inline-size: var(--chat-width);
  padding: .62rem .82rem;
  border: 1px solid var(--chat-incoming-line);
  border-radius: .95rem;
  border-end-start-radius: .3rem;
  background: var(--chat-incoming);
  color: var(--text, #f7f2ef);
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.remote-chat .chat-mine .chat-bubble {
  border-color: var(--chat-outgoing-line);
  border-end-start-radius: .95rem;
  border-end-end-radius: .3rem;
  background: var(--chat-outgoing);
}
.remote-chat .chat-unknown .chat-bubble {
  border-color: var(--chat-neutral-line);
  border-radius: .8rem;
  background: var(--chat-neutral);
}
.remote-chat .chat-bubble p,
.remote-chat .chat-preview {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.remote-chat .chat-bubble p + p {
  margin-block-start: .5rem;
}
.remote-chat .chat-medium {
  display: inline-block;
  border: 1px solid #53607e;
  border-radius: .45rem;
  padding: .12rem .45rem;
  background: #12172578;
  color: #d3d9ee;
  font-size: .875rem;
}

.remote-chat .chat-bubble details {
  min-inline-size: 0;
}
.remote-chat .chat-bubble details summary {
  display: grid;
  justify-items: start;
  gap: .25rem;
  min-block-size: 44px;
  list-style: none;
  cursor: pointer;
}
.remote-chat .chat-bubble details summary::-webkit-details-marker {
  display: none;
}
.remote-chat .chat-bubble details summary:focus-visible {
  outline: 2px solid var(--accent, #f2b9cb);
  outline-offset: 3px;
  border-radius: .35rem;
}
.remote-chat .chat-expand,
.remote-chat .chat-collapse {
  display: inline-flex;
  align-items: center;
  min-block-size: 44px;
  color: #d8c8f7;
  font-size: .875rem;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: .18em;
}
.remote-chat .chat-bubble details:not([open]) .chat-collapse,
.remote-chat .chat-bubble details[open] :is(.chat-preview, .chat-expand) {
  display: none;
}
.remote-chat .chat-bubble details[open] summary {
  margin-block-end: .3rem;
}

.remote-chat .remote-paging {
  padding-block: .6rem;
  color: var(--chat-meta);
  font-variant-numeric: tabular-nums;
}
.remote-chat .remote-paging button {
  min-block-size: 44px;
}

@media (max-width: 760px) {
  #reader.remote-chat {
    --chat-width: min(91%, 36rem);
  }
  .remote-chat .remote-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .remote-chat .remote-filter > .search-field {
    grid-column: 1 / -1;
  }
  .remote-chat .results .chat-month {
    gap: .8rem;
  }
  .remote-chat .chat-bubble {
    padding: .55rem .7rem;
  }
}
@media (min-width: 400px) and (max-width: 760px) {
  .remote-chat .remote-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 399px) {
  .remote-chat #chat-order-field { grid-column: 1 / -1; }
}

.remote-videos h2 { margin: 0 0 .75rem; }
.remote-videos-feedback:empty { display: none; }
.remote-videos-list { display: grid; gap: .65rem; min-inline-size: 0; }
.remote-video-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: start;
  gap: .6rem .8rem;
  min-inline-size: 0;
  padding: .8rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--panel-deep);
}
.remote-video-meta { min-inline-size: 0; overflow-wrap: anywhere; }
.remote-video-source { display: block; color: var(--text); font-weight: 650; }
.remote-video-detail { display: flex; flex-wrap: wrap; gap: .16rem .6rem; color: var(--muted); font-size: .86rem; }
.remote-video-detail time { font-variant-numeric: tabular-nums; }
.remote-video-play { min-block-size: 44px; }
.remote-video-player {
  display: block;
  grid-column: 1 / -1;
  inline-size: 100%;
  max-block-size: min(60vh, 37rem);
  border-radius: .65rem;
  background: var(--bg);
}
.remote-video-feedback { grid-column: 1 / -1; margin: 0; }
@media (max-width: 470px) {
  .remote-video-item { gap: .45rem .6rem; padding: .65rem; }
  .remote-video-play { padding-inline: .62rem; }
}
