body:has(.reader-app) #topbar { display: none; }

.reader-app {
  --reader-accent: #4e46ca;
  --reader-soft: #f0effc;
  --reader-line: #e1e3ec;
  --reader-ink: #202235;
  --reader-muted: #656b7d;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  background: #fff;
  color: var(--reader-ink);
  font-family: var(--sans);
}
.reader-app :focus-visible {
  outline: 2px solid var(--reader-accent);
  outline-offset: 3px;
}
.reader-tools {
  position: fixed; z-index: 3; right: max(12px, env(safe-area-inset-right)); top: 58%;
  transform: translateY(-50%); display: flex; flex-direction: row-reverse; align-items: center;
}
.reader-tools .reader-tools-handle, .reader-actions {
  background: linear-gradient(150deg, #ffffffed, #f5f6fbed);
  border: 1px solid #fff; box-shadow: 0 0 0 1px #32344d10, 0 8px 24px -7px #21254040, inset 0 1px #fff;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
}
.reader-tools .reader-tools-handle {
  width: 46px; height: 46px; min-height: 46px; padding: 0; border-radius: 17px;
  opacity: .67; color: #524d73; transition: opacity .2s, transform .24s, box-shadow .24s;
}
.reader-tools .reader-tools-handle[aria-expanded=true], .reader-tools-handle:focus-visible,
.reader-tools.is-marking .reader-tools-handle { opacity: 1; transform: translateY(-1px); color: #5142b0; }
.reader-tools-handle svg { width: 23px; height: 23px; }
.reader-actions {
  width: min(220px, calc(100vw - 80px)); margin-right: 8px; padding: 7px; border-radius: 21px;
  display: grid; gap: 2px; transform-origin: right center;
}
.reader-actions:not([hidden]) { animation: reader-tools-in .23s cubic-bezier(.2,.8,.2,1) both; }
@keyframes reader-tools-in { from {opacity:0; transform:translateX(7px) scale(.97)} }
.reader-actions .btn, .reader-info summary {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: flex-start;
  gap: 11px; padding: 5px 9px; border: 0; border-radius: 13px; color: #333347;
  font: 600 14px/1.35 var(--sans); background: transparent; cursor: pointer;
}
.reader-actions .btn > svg, .reader-info summary > svg:first-child {
  width: 31px; height: 31px; padding: 7px; box-sizing: border-box; border-radius: 10px;
  color: #626078; background: #e9eaf1;
}
.reader-actions .reader-comments-button > svg { color: #5749ad; background: #e9e6fc; }
.reader-actions .btn:hover, .reader-actions .btn[aria-pressed=true], .reader-info summary:hover { background: #eaeaf3; }
.reader-info { overflow-wrap: anywhere; border-top: 1px solid #35345210; margin-top: 2px; padding-top: 4px; }
.reader-info summary { list-style: none; font-weight: 500; color: #67677c; }
.reader-info summary::-webkit-details-marker, .reader-compose > summary::-webkit-details-marker { display: none; }
.reader-info summary > svg:last-child { width: 13px; height: 13px; margin-left: auto; transition: transform .18s; }
.reader-info[open] summary > svg:last-child { transform: rotate(90deg); }
.reader-info strong, .reader-info small, .reader-info p { display: block; margin: 5px 10px 8px; font-size: 12px; }
.reader-info small { color: var(--reader-muted); }
.reader-compose > summary { display: flex; align-items: center; }
.markdown-title { max-width: 820px; margin: auto; padding: 32px clamp(18px, 4vw, 52px) 0; font-size: clamp(26px, 4vw, 40px); }
@media (prefers-reduced-motion: reduce) { .reader-tools .reader-tools-handle { transition: none; } }
.reader-count, .reader-app .discussion-count {
  border-radius: 8px;
  background: #eef0f6;
  color: #586079;
  font: 650 11px/1.4 var(--sans);
  padding: 1px 5px;
}
.reader-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
}
.reader-canvas { min-width: 0; min-height: 0; background: #fff; overflow: auto; }
.reader-canvas .html-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}
.reader-markdown > .prose {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 62px) clamp(18px, 4vw, 52px) 60px;
  color: var(--reader-ink);
  font: 16px/1.85 var(--sans);
}
.reader-markdown .prose :is(h2, h3, h4, h5, h6) { font-family: var(--sans); color: var(--reader-ink); }
.reader-markdown .prose blockquote, .reader-app .comment-text blockquote {
  color: #515368;
  background: #f4f5fa;
  border-color: #b4afea;
}
.reader-markdown .prose pre, .reader-markdown .prose code { background: #f3f4f8; }
.reader-markdown .anchor-btn { color: var(--reader-accent); }
.reader-markdown .anchor-block:hover .anchor-btn, .reader-markdown .anchor-btn:focus-visible { background: var(--reader-soft); }
.reader-drawer {
  --drawer-gap: 14px;
  position: fixed; inset: var(--drawer-gap) var(--drawer-gap) var(--drawer-gap) auto;
  margin: 0; padding: 0; width: min(410px, calc(100vw - 2 * var(--drawer-gap)));
  height: calc(100% - 2 * var(--drawer-gap)); max-height: none; max-width: none; overflow: hidden;
  border: 1px solid #ffffffed; border-radius: 25px; color: var(--reader-ink); background: #fafafd;
  box-shadow: 0 0 0 1px #20213812, -14px 14px 68px -12px #17152f40, inset 0 1px #fff;
  opacity: 0; transform: translateX(calc(100% + var(--drawer-gap)));
  transition: transform .32s cubic-bezier(.3,0,.5,1), opacity .22s, display .32s allow-discrete, overlay .32s allow-discrete;
}
.reader-drawer[open] {
  opacity: 1; transform: none;
  transition: transform .44s cubic-bezier(.16,1,.3,1), opacity .24s, display .44s allow-discrete, overlay .44s allow-discrete;
}
.reader-drawer::backdrop {
  background: linear-gradient(90deg, #1d203316, #22213935);
  opacity: 0; transition: opacity .28s, display .28s allow-discrete, overlay .28s allow-discrete;
}
.reader-drawer[open]::backdrop { opacity: 1; }
@starting-style {
  .reader-drawer[open] { opacity: 0; transform: translateX(calc(100% + var(--drawer-gap))); }
  .reader-drawer[open]::backdrop { opacity: 0; }
}
.reader-drawer .discussion {
  display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 0; margin: 0; border: 0;
}
.reader-app .discussion-heading {
  position: relative; display: grid; grid-template-columns: 41px minmax(0,1fr) 38px;
  align-items: center; gap: 3px 12px; flex: none; padding: 23px 20px 20px;
  background: linear-gradient(150deg,#fff 25%,#f3f2fa); box-shadow: 0 1px #29274112;
}
.drawer-heading-icon {
  grid-row: span 2; height: 41px; display: grid; place-items: center; color: #5a4ca1;
  border-radius: 14px; background: linear-gradient(140deg,#eeecfc,#dfdbf4); box-shadow: inset 0 1px #fff;
}
.drawer-heading-icon svg { width: 23px; height: 23px; }
.reader-app .discussion-heading h2 { display: flex; align-items: center; gap: 6px; margin: 0; font: 660 19px/1.35 var(--sans); }
.drawer-case-title { grid-column: 2; margin: 0; color: #696879; font: 12px/1.45 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-app .discussion-count:empty { display: none; }
.reader-app .reader-close {
  grid-column: 3; grid-row: 1 / span 2; justify-self: end; width: 36px; min-height: 36px;
  padding: 8px; border: 0; border-radius: 50%; color: #646179; background: #eaeaf180;
}
.reader-app .reader-close:hover { background: #e0dfea; color: #242239; }
.reader-app .reader-feed { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px; }
.reader-app .reader-feed > .btn { margin-top: 12px; }
.reader-feed:has(.comment-empty) { display: grid; align-content: center; }
.reader-app .comment-empty { display: grid; justify-items: center; gap: 9px; padding: 12px; text-align: center; }
.reader-app .comment-empty strong { font-size: 17px; font-weight: 620; color: #333244; }
.reader-app .comment-empty p { max-width: 240px; margin: 0; line-height: 1.6; font-size: 13px; color: #6b697b; }
.empty-chat {
  width: 63px; height: 57px; position: relative; isolation: isolate; display: grid; place-items: center; margin: 0 0 10px;
  color: #69609a;
}
.empty-chat::before {
  content: ""; position: absolute; width: 42px; height: 39px; z-index: -1; top: -6px; right: -7px;
  border-radius: 13px; background: linear-gradient(145deg,#e9e6f7,#d6d0eb); transform: rotate(12deg);
}
.empty-chat::after {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 18px; border: 1px solid #fff;
  background: linear-gradient(150deg,#fff,#eeecf7); box-shadow: 0 6px 14px -6px #4843634a, 0 0 0 1px #6f698321;
}
.empty-chat svg { width: 30px; height: 30px; }
.reader-app .comment-row {
  gap: 10px; padding: 14px; border: 1px solid #e8e7ef; border-radius: 17px; background: #fff;
  box-shadow: 0 3px 8px -6px #24233c28; margin-bottom: 9px;
}
.reader-app .comment-row:focus { background: var(--reader-soft); }
.reader-app .avatar { color: #5a5188; background: #efecf8; width: 30px; height: 30px; }
.reader-app .comment-who { gap: 4px 9px; }
.reader-app .comment-who strong { font-size: 14px; }
.reader-app .comment-who time { font-size: 11px; color: var(--reader-muted); }
.reader-app .comment-text { font-size: 14px; }
.reader-app .comment-text blockquote { line-height: 1.55; padding: 6px 9px; }
.reader-app .comment-text .btn { color: var(--reader-accent); padding: 4px 0; min-height: 28px; }
.reader-app .reader-compose {
  flex: none; max-height: 76%; overflow: auto; padding: 12px 16px max(15px,env(safe-area-inset-bottom));
  border-top: 1px solid #eeedf2; background: #fff;
}
.reader-compose > summary {
  min-height: 46px; gap: 10px; padding: 9px 15px; list-style: none; cursor: pointer; border-radius: 14px;
  color: #fff; font: 580 14px var(--sans); background: linear-gradient(120deg,#363449,#4e4865);
  box-shadow: inset 0 1px #ffffff30, 0 3px 8px -4px #23223944;
}
.reader-compose > summary svg { width: 17px; height: 17px; }
.reader-compose > summary svg:last-child { margin-left: auto; transform: rotate(-90deg); }
.reader-compose[open] > summary { color: #4d4961; background: #f1f0f5; box-shadow: none; }
.reader-compose[open] > summary svg:last-child { transform: rotate(90deg); }
.reader-app .comment-form { margin: 0; padding: 14px 0 0; gap: 11px; border: 0; background: transparent; }
.reader-app .comment-form .field { gap: 4px; }
.reader-app .comment-form .field:first-child { max-width: none; }
.reader-app .comment-form .field-name { color: #514e60; font-size: 12px; }
.reader-app .comment-form :is(input, textarea) { border: 1px solid #dedce8; padding: 10px; font-size: 14px; border-radius: 11px; }
.reader-app .comment-form .primary { background: #49435e; border-color: transparent; border-radius: 11px; min-height: 40px; }
.reader-app .comment-form .primary:hover { background: #353146; }
.reader-app .anchor-details { color: var(--reader-muted); }
.reader-app .reader-quote-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin-top: 6px;
}
.reader-quote-line > span { color: var(--reader-accent); font: 600 24px/1 Georgia, serif; }
.reader-app .anchor-details.has-target > summary { display: none; }
.reader-app .has-target .reader-quote-line {
  margin: 0;
  padding: 4px 5px 4px 9px;
  border-left: 3px solid #7770d9;
  border-radius: 3px;
  background: var(--reader-soft);
}
.reader-app .reader-quote-line input[readonly] {
  min-width: 0;
  padding: 3px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #423b86;
  font-weight: 600;
  border: 0;
  background: transparent;
}
.reader-quote-line .reader-clear-quote { flex: none; min-width: 28px; min-height: 28px; padding: 4px; color: #595287; }
.reader-quote-line .reader-clear-quote:hover { background: #e1dff6; }
.reader-drawer:has(.reader-compose[open]) .comment-empty { display: none; }
.reader-app .error:not(:empty) { margin: 8px 18px; }
@media (max-width: 760px) {
  .reader-drawer { --drawer-gap: 6px; width: min(410px, calc(100vw - 16px)); border-radius: 21px; }
  .reader-app .discussion-heading { padding: 17px 14px; }
  .reader-app .reader-close { min-height: 44px; width: 38px; }
  .reader-app .reader-feed { padding: 14px; }
  .reader-app .reader-compose[open] { max-height: 85%; }
  .reader-app .comment-form :is(input,textarea) { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .reader-actions:not([hidden]) { animation: none; }
  .reader-drawer, .reader-drawer[open], .reader-drawer::backdrop, .reader-tools .reader-tools-handle { transition: none; }
}

.reader-app { position: relative; }
.reader-app.is-preparing .reader-stage { opacity: 0; pointer-events: none; }
.reader-stage { transition: opacity .22s ease-out; }
.reader-loading {
  position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center;
  gap: 35px; color: #49495a; background: radial-gradient(ellipse at 50% 45%, #f3f3ff, #fafafc 55%, #f3f5f8);
  font: 520 14px/1.5 var(--sans);
}
.reader-app .reader-loading { position: absolute; }
.loading-sculpture { position: relative; width: 76px; height: 74px; isolation:isolate; }
.loading-sculpture::before, .loading-sculpture::after, .loading-sculpture i {
  content:""; position:absolute; display:block; inset:8px 5px; border-radius:14px;
  transform:rotate(-26deg) skewY(10deg); border:1px solid #ffffffb3;
}
.loading-sculpture::before { background: linear-gradient(140deg,#d4dcf3,#888eb9); top:23px; bottom:-7px; box-shadow: 0 14px 19px -8px #535e9d60; }
.loading-sculpture i { top:16px; bottom:0; background:linear-gradient(140deg,#e7edffed,#a4aad9ed); }
.loading-sculpture::after {
  background:linear-gradient(120deg,#d3d9f4 15%,#fafaff 38%,#c8ccef 56%,#ebf2ff 80%); background-size:250% 100%;
  box-shadow:inset 0 1px 2px #fff, inset 0 -1px 1px #7883c040;
  animation: sheet-sheen 2.4s ease-in-out infinite alternate;
}
@keyframes sheet-sheen {
  from {transform:translateY(1px) rotate(-26deg) skewY(10deg);background-position:0% 50%}
  to {transform:translateY(-4px) rotate(-26deg) skewY(10deg);background-position:90% 50%}
}
.load-issue .loading-sculpture::after { animation:none; }
@media(prefers-reduced-motion:reduce) {
  .reader-stage {transition:none} .loading-sculpture::after {animation:none}
}
.reader-app:not(.is-preparing) > .reader-loading {
  opacity:0; visibility:hidden; pointer-events:none;
  transition:opacity .22s ease-out, visibility 0s linear .22s;
}
@media(prefers-reduced-motion:reduce) { .reader-app:not(.is-preparing) > .reader-loading { transition:none; } }

/*! Adapted from flohoeller/affectui motion/shimmer-loader.tsx @ 8578488.
MIT License

Copyright (c) 2026 Florian Höller (adfects)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

@media screen and (prefers-reduced-motion:no-preference) {
  .reader-loading:not(.load-issue) .loading-caption {
    background-image:linear-gradient(90deg,#4b4c63 0%,#4b4c63 40%,#8b8ca8 50%,#4b4c63 60%,#4b4c63 100%);
    background-size:300% 100%;background-position:100% 0;background-clip:text;-webkit-background-clip:text;
    -webkit-text-fill-color:transparent;animation:case-shimmer-text 2.4s linear infinite;
  }
  @keyframes case-shimmer-text {from{background-position:100% 0}to{background-position:0% 0}}
}
