/* Perry's reading room: additive, scoped extensions for the existing theme. */
body.perry-upgraded {
  --perry-u-ink: #26334a;
  --perry-u-muted: #62718a;
  --perry-u-border: rgba(81, 106, 144, .18);
  --perry-u-paper: rgba(255, 255, 255, .9);
  --perry-u-soft: rgba(90, 125, 155, .07);
  --perry-u-accent: #436d8b;
  --perry-wallpaper-url: url('/img/wallpapers/orbit.svg');
}
[data-theme='dark'] body.perry-upgraded {
  --perry-u-ink: #dce6f1;
  --perry-u-muted: #a4b3c8;
  --perry-u-border: rgba(154, 181, 210, .18);
  --perry-u-paper: rgba(13, 23, 39, .94);
  --perry-u-soft: rgba(132, 169, 198, .08);
  --perry-u-accent: #97c8d9;
}
body.perry-upgraded[data-perry-wallpaper='dawn'] { --perry-wallpaper-url: url('/img/wallpapers/dawn.svg'); }
body.perry-upgraded[data-perry-wallpaper='mist'] { --perry-wallpaper-url: url('/img/wallpapers/mist.svg'); }
body.perry-upgraded #web_bg {
  background-image: linear-gradient(rgba(246, 249, 252, .62), rgba(246, 249, 252, .88)), var(--perry-wallpaper-url);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  animation: none;
}
[data-theme='dark'] body.perry-upgraded #web_bg {
  background-image: linear-gradient(rgba(5, 10, 22, .48), rgba(5, 10, 22, .85)), var(--perry-wallpaper-url);
}
body.perry-upgraded .poem-portal {
  background-image: linear-gradient(rgba(7, 12, 27, .55), rgba(7, 12, 27, .68)), var(--perry-wallpaper-url);
  background-size: cover;
  background-position: center;
}
[data-theme='light'] body.perry-upgraded .poem-portal {
  background-image: linear-gradient(rgba(244, 247, 253, .83), rgba(244, 247, 253, .85)), var(--perry-wallpaper-url);
}
body.perry-upgraded.research-galaxy-index .galaxy-hero {
  --perry-parallax: 0px;
  min-height: 430px;
  padding: 38px 0 40px;
  background-image: linear-gradient(90deg, rgba(5, 10, 22, .93), rgba(5, 10, 22, .38)), var(--perry-wallpaper-url);
  background-size: cover;
  background-position: center calc(50% + var(--perry-parallax));
  animation: none;
}
body.perry-upgraded.research-galaxy-index .galaxy-hero::before { transform: translateY(calc(var(--perry-parallax) * -.7)); }
body.perry-upgraded.research-galaxy-index .galaxy-hero-inner { padding-top: 10px; padding-bottom: 10px; }
body.perry-upgraded.research-galaxy-index .galaxy-hero h1 { margin: 16px 0 10px; }
body.perry-upgraded.research-galaxy-index .galaxy-hero h1 strong { font-size: clamp(70px, 9vw, 114px); line-height: 1.03; }
body.perry-upgraded.research-galaxy-index .galaxy-hero h1 em { margin-top: 5px; font-size: clamp(30px, 4vw, 45px); }
body.perry-upgraded.research-galaxy-index .galaxy-subtitle { margin-top: 15px; font-size: 11px; }
body.perry-upgraded.research-galaxy-index .galaxy-copy { max-width: 580px; line-height: 1.8; }
body.perry-upgraded.research-galaxy-index .galaxy-actions { margin-top: 20px; gap: 9px; }
body.perry-upgraded.research-galaxy-index .galaxy-button { padding: 8px 14px; }
body.perry-upgraded.research-galaxy-index .galaxy-motto { position: static; margin: 24px 0 0 6px; }
body.perry-upgraded.research-galaxy-index .galaxy-orbit-mark { width: 96px; height: 96px; font-size: 44px; transform: translateY(calc(var(--perry-parallax) * -.5)); }
body.perry-upgraded.research-galaxy-index .galaxy-section { padding-top: 64px; }
body.perry-upgraded.research-galaxy-index .galaxy-section-head { gap: 36px; margin-bottom: 28px; }
body.perry-upgraded.research-galaxy-index .galaxy-section-head h2 { font-size: clamp(35px, 4.2vw, 51px); }
[data-theme='light'] body.perry-upgraded.research-galaxy-index .galaxy-hero {
  background-image: linear-gradient(90deg, rgba(244, 248, 252, .96), rgba(244, 248, 252, .55)), var(--perry-wallpaper-url);
}
[data-theme='light'] body.perry-upgraded .galaxy-hero h1 strong { color: #24344c; background: none; }
[data-theme='light'] body.perry-upgraded .galaxy-hero h1 em,
[data-theme='light'] body.perry-upgraded .galaxy-hero .galaxy-subtitle { color: #4d657f; }
[data-theme='light'] body.perry-upgraded .galaxy-hero .galaxy-copy { color: #586b85; }
[data-theme='light'] body.perry-upgraded .galaxy-hero .galaxy-button { color: #314b68; border-color: rgba(64, 104, 141, .3); }
[data-theme='light'] body.perry-upgraded .galaxy-hero .galaxy-button.primary { color: #fff; }
[data-theme='light'] body.perry-upgraded .galaxy-eyebrow { color: #456a87; }
[data-theme='light'] body.perry-upgraded.research-galaxy-index #page-header:not(.nav-fixed) #site-name,
[data-theme='light'] body.perry-upgraded.research-galaxy-index #page-header:not(.nav-fixed) .site-page { color: #263e59 !important; }
[data-theme='light'] body.perry-upgraded.research-galaxy-index #page-header.not-top-img #nav { color: #263e59; background: rgba(247, 250, 253, .8); border-color: rgba(83, 110, 142, .12); }

.perry-hero-search { display: flex; align-items: center; gap: 10px; width: min(480px, 100%); margin: 22px 0 0 6px; padding: 10px 14px; color: #d6e1ed; border: 1px solid rgba(178, 201, 222, .23); border-radius: 11px; background: rgba(23, 36, 55, .5); font-size: 13px; text-decoration: none; transition: background .2s, border-color .2s; }
.perry-hero-search svg, .perry-dock svg, .perry-wallpaper svg, .perry-reader-tools svg { flex-shrink: 0; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.perry-hero-search span { flex: 1; }
.perry-hero-search small { opacity: .68; font-size: 10px; }
.perry-hero-search:hover { color: #f5f8ff; background: rgba(47, 67, 94, .55); }
[data-theme='light'] .perry-hero-search { color: #415a73; background: rgba(255, 255, 255, .66); border-color: rgba(63, 95, 131, .24); }
[data-theme='light'] .perry-hero-search:hover { color: #274864; background: #fff; }
.perry-dock { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; width: fit-content; max-width: 100%; margin: 15px 0 0 6px; padding: 7px; border: 1px solid rgba(174, 198, 220, .18); border-radius: 16px; background: rgba(11, 24, 40, .46); }
.perry-dock a { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px; border-radius: 10px; color: #b8ccdd; font-size: 11px; line-height: 1.4; text-decoration: none; }
.perry-dock a:hover { color: #edf5ff; background: rgba(150, 180, 205, .12); }
[data-theme='light'] .perry-dock { background: rgba(255, 255, 255, .65); border-color: rgba(64, 94, 121, .16); }
[data-theme='light'] .perry-dock a { color: #4c667d; }
[data-theme='light'] .perry-dock a:hover { color: #233e59; background: rgba(81, 119, 152, .08); }

/* A true single-column list; never place metadata on top of summaries. */
body.perry-upgraded.research-galaxy-index #recent-posts { display: flex !important; flex-direction: column; gap: 18px; max-width: 1120px; margin-inline: auto; }
body.perry-upgraded.research-galaxy-index #recent-posts > .recent-post-item { display: grid !important; grid-template-columns: 230px minmax(0, 1fr); width: 100% !important; min-height: 225px; height: auto !important; margin: 0 !important; padding: 0 !important; border-color: var(--perry-u-border); border-radius: 17px; background: var(--perry-u-paper); overflow: hidden; }
body.perry-upgraded.research-galaxy-index #recent-posts > .recent-post-item:hover { transform: translateY(-2px); box-shadow: 0 8px 26px rgba(20, 40, 65, .08); }
body.perry-upgraded.research-galaxy-index #recent-posts > .recent-post-item.perry-text-only { grid-template-columns: minmax(0, 1fr); }
body.perry-upgraded.research-galaxy-index #recent-posts .post_cover { order: 0 !important; width: 100% !important; height: 100% !important; min-height: 225px; margin: 0 !important; border-radius: 0 !important; }
body.perry-upgraded.research-galaxy-index #recent-posts .post_cover img { width: 100%; height: 100%; object-fit: cover; opacity: .9; filter: saturate(.65) contrast(.94); }
body.perry-upgraded.research-galaxy-index #recent-posts .recent-post-info { display: flex !important; flex-direction: column; gap: 13px; width: 100% !important; min-width: 0; height: auto !important; padding: 24px 28px !important; overflow: visible; }
body.perry-upgraded.research-galaxy-index #recent-posts .recent-post-info.no-cover { grid-column: 1 / -1; }
body.perry-upgraded.research-galaxy-index #recent-posts .recent-post-info-top { flex: none !important; }
body.perry-upgraded.research-galaxy-index #recent-posts .recent-post-info-top-tips { position: static !important; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; color: var(--perry-u-muted); line-height: 1.6; }
body.perry-upgraded.research-galaxy-index #recent-posts .article-title { display: block !important; height: auto !important; min-height: 0 !important; max-height: none !important; margin: 0 !important; overflow: visible !important; color: var(--perry-u-ink) !important; font-size: clamp(19px, 2.3vw, 25px); font-weight: 650; line-height: 1.5 !important; white-space: normal; -webkit-line-clamp: unset !important; overflow-wrap: anywhere; }
body.perry-upgraded.research-galaxy-index #recent-posts .content { display: block !important; order: 1; height: auto !important; min-height: 0 !important; max-height: none !important; margin: 0 !important; overflow: visible !important; color: var(--perry-u-muted) !important; font-size: 13px; line-height: 1.9; -webkit-line-clamp: unset !important; overflow-wrap: anywhere; }
body.perry-upgraded.research-galaxy-index #recent-posts .article-meta-wrap { position: static !important; display: flex !important; flex-wrap: wrap; align-items: center; gap: 8px 14px; order: 2; width: 100% !important; height: auto !important; margin-top: auto; color: var(--perry-u-muted) !important; font-size: 11px; line-height: 1.8; }
body.perry-upgraded.research-galaxy-index #recent-posts .article-meta-wrap > span { position: static !important; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; }
body.perry-upgraded.research-galaxy-index #recent-posts .article-meta__tags { color: var(--perry-u-muted); margin-right: 7px; }
body.perry-upgraded.research-galaxy-index #recent-posts .unvisited-post { color: var(--perry-u-muted); font-size: 11px; }
body.perry-upgraded.research-galaxy-index #recent-posts .article-categories-original { color: var(--perry-u-accent); background: var(--perry-u-soft); }
body.perry-upgraded.research-galaxy-index #recent-posts #pagination { width: 100%; margin-top: 16px; }

.perry-wallpaper { position: fixed; left: 18px; bottom: 18px; z-index: 998; font-size: 11px; color: var(--perry-u-muted); }
.perry-wallpaper-toggle { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 12px; border: 1px solid var(--perry-u-border); border-radius: 12px; color: inherit; background: var(--perry-u-paper); backdrop-filter: blur(12px); font: inherit; cursor: pointer; box-shadow: 0 4px 18px rgba(12, 24, 40, .08); }
.perry-wallpaper-menu { position: absolute; bottom: 46px; left: 0; width: 176px; padding: 12px; border: 1px solid var(--perry-u-border); border-radius: 14px; background: var(--perry-u-paper); box-shadow: 0 10px 35px rgba(6, 18, 37, .16); }
.perry-wallpaper-menu[hidden] { display: none; }
.perry-wallpaper-menu p { margin: 0 0 7px; padding: 0 5px; font-size: 10px; line-height: 1.8; color: var(--perry-u-muted); }
.perry-wallpaper-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--perry-u-ink); text-align: left; font: inherit; cursor: pointer; }
.perry-wallpaper-menu button[aria-pressed='true'], .perry-wallpaper-menu button:hover { background: var(--perry-u-soft); }
.perry-wallpaper-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--perry-u-border); background: #21334c; }
.perry-wallpaper-dot.dawn { background: linear-gradient(135deg, #cba298, #9cbccc); }
.perry-wallpaper-dot.mist { background: linear-gradient(135deg, #91afb2, #d3dfd9); }
.perry-wallpaper-dot.daily { background: conic-gradient(#24374e, #cba298, #aec9c6, #24374e); }

/* Shared library, notebook, tutorial and goal surfaces. */
.perry-hub { color: var(--perry-u-ink); }
.perry-hub-hero { margin-bottom: 32px; padding-bottom: 25px; border-bottom: 1px solid var(--perry-u-border); }
.perry-hub-hero > span, .perry-hub-kicker { color: var(--perry-u-accent); font: 10px/1.6 Consolas, monospace; letter-spacing: .13em; }
.perry-hub-hero h1 { margin: 12px 0 14px !important; color: inherit; font-family: inherit; font-size: clamp(28px, 4vw, 42px); font-weight: 600; font-style: normal; line-height: 1.4; }
.perry-hub-hero h1.perry-display-title, [lang='en'] .perry-hub-hero h1 { font-family: var(--perry-display); font-size: clamp(42px, 6vw, 68px); font-style: italic; line-height: 1.2; }
.perry-hub-hero p { max-width: 720px; color: var(--perry-u-muted); line-height: 1.9; }
.perry-hub nav:not(.perry-doc-nav), .perry-hub-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 16px 0; }
.perry-hub-actions a, .perry-hub > nav a { padding: 8px 12px; border: 1px solid var(--perry-u-border); border-radius: 8px; color: var(--perry-u-accent); font-size: 12px; text-decoration: none !important; }
.perry-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 20px 0 36px; }
.perry-panel, .perry-library-card, .perry-notebook-item, .perry-goal { min-width: 0; padding: 24px; border: 1px solid var(--perry-u-border); border-radius: 14px; color: var(--perry-u-ink); background: var(--perry-u-soft); }
.perry-library-card { display: flex; flex-direction: column; gap: 8px; color: inherit !important; text-decoration: none !important; transition: border-color .2s, transform .2s; }
.perry-library-card:hover { transform: translateY(-2px); border-color: var(--perry-u-accent); }
.perry-library-card > span, .perry-library-card > small, .perry-notebook-item time { color: var(--perry-u-accent); font-size: 10px; letter-spacing: .07em; }
.perry-library-card h2, .perry-library-card h3, .perry-panel > h2 { margin: 6px 0 8px !important; padding: 0 !important; border: 0 !important; line-height: 1.5 !important; font-size: 21px; }
.perry-library-card p, .perry-notebook-item p, .perry-goal p { margin: 0 !important; color: var(--perry-u-muted); font-size: 13px; line-height: 1.85; }
.perry-library-card > b, .perry-library-card > em { margin-top: auto; padding-top: 14px; color: var(--perry-u-accent); font-size: 11px; font-weight: 500; font-style: normal; }
.perry-notebook-item { margin: 13px 0; border-left: 3px solid var(--perry-u-accent); }
.perry-notebook-item h2, .perry-notebook-item h3 { margin-top: 8px !important; }
.perry-goal { margin: 14px 0; }
.perry-goal progress { display: block; width: 100%; height: 7px; margin: 15px 0 8px; accent-color: var(--perry-u-accent); }
.perry-resource-card { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; padding: 16px 19px; border: 1px solid var(--perry-u-border); border-radius: 11px; background: var(--perry-u-soft); color: inherit; text-decoration: none !important; overflow-wrap: anywhere; }
.perry-resource-card > span, .perry-resource-card small { color: var(--perry-u-muted); font-size: 12px; line-height: 1.75; }
.perry-doc-layout { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 28px; align-items: start; }
.perry-doc-nav { position: sticky; top: 92px; display: flex; flex-direction: column; gap: 5px; max-height: calc(100vh - 122px); padding: 16px; overflow-y: auto; border: 1px solid var(--perry-u-border); border-radius: 12px; background: var(--perry-u-soft); font-size: 12px; }
.perry-doc-nav a { display: block; padding: 7px 8px; border-radius: 6px; line-height: 1.65; color: var(--perry-u-muted); text-decoration: none !important; }
.perry-doc-nav a[aria-current='page'], .perry-doc-nav a[aria-current='location'], .perry-doc-nav a:hover { color: var(--perry-u-accent); background: var(--perry-u-soft); }
.perry-doc-nav > b, .perry-doc-nav > strong { margin: 2px 8px 10px; color: var(--perry-u-ink); font-size: 12px; }
.perry-doc-content { min-width: 0; }
body.perry-upgraded.perry-has-docs #page { max-width: 1120px; width: 100%; }
body.perry-upgraded.perry-page-reading #page { padding: 32px; }
body.perry-upgraded.perry-has-docs #aside-content { display: none; }
body.perry-upgraded.perry-page-reading #aside-content .card-widget:not(.card-toc):not(.perry-context-card) { display: none; }
.perry-context-card { padding: 22px !important; color: var(--perry-u-ink); }
.perry-context-card h3 { margin: 0 0 12px; font-family: var(--perry-display); font-size: 25px; font-style: italic; font-weight: 600; }
.perry-context-card a { display: block; padding: 7px 0; color: var(--perry-u-muted); font-size: 12px; line-height: 1.6; }
.perry-context-card p { color: var(--perry-u-muted); font-size: 11px; line-height: 1.7; }
.perry-reader-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 15px 0 24px; }
.perry-reader-tools button, .perry-reader-tools a { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--perry-u-border); border-radius: 8px; color: var(--perry-u-accent); background: var(--perry-u-soft); font-family: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; text-decoration: none !important; }

/* Article components: simple DOM, native details and no autoplay. */
.perry-carousel { margin: 28px 0; padding: 16px; border: 1px solid var(--perry-u-border); border-radius: 14px; background: var(--perry-u-soft); }
.perry-carousel-slides { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.perry-carousel-slides > * { min-width: 0; margin: 0 !important; padding: 8px; scroll-snap-align: center; }
.perry-carousel-slides img { display: block; width: auto; max-width: 100%; max-height: 480px; margin: 0 auto; object-fit: contain; }
.perry-carousel-slides figcaption { margin-top: 12px; color: var(--perry-u-muted); font-size: 12px; text-align: center; line-height: 1.8; }
.perry-carousel-controls { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 14px; }
.perry-carousel-controls button { width: 36px; height: 34px; border: 1px solid var(--perry-u-border); border-radius: 8px; color: var(--perry-u-accent); background: var(--perry-u-paper); cursor: pointer; font-size: 18px; }
.perry-carousel-controls button:disabled { opacity: .35; cursor: default; }
.perry-carousel-controls output { min-width: 60px; text-align: center; color: var(--perry-u-muted); font: 11px Consolas, monospace; }
.perry-file-tree { margin: 24px 0; padding: 22px; border: 1px solid var(--perry-u-border); border-radius: 12px; background: var(--perry-u-soft); color: var(--perry-u-ink); font: 12px/1.9 Consolas, monospace; overflow-x: auto; }
.perry-file-tree details { margin: 4px 0; padding: 0; border: 0; background: none; }
.perry-file-tree summary { cursor: pointer; color: var(--perry-u-accent); }
.perry-file-tree ul { margin: 6px 0 6px 9px !important; padding-left: 21px !important; border-left: 1px solid var(--perry-u-border); list-style: none !important; }
.perry-file-tree li { position: relative; list-style: none !important; }
.perry-file-tree li::before { content: ''; position: absolute; left: -21px; top: 14px; width: 12px; height: 1px; background: var(--perry-u-border); }
.perry-file-tree li small { margin-left: 10px; color: var(--perry-u-muted); font-family: inherit; font-size: 11px; line-height: 1.7; }
.perry-frame { margin: 26px 0; overflow: hidden; border: 1px solid var(--perry-u-border); border-radius: 13px; background: var(--perry-u-paper); box-shadow: 0 10px 26px rgba(22, 44, 63, .07); }
.perry-frame-bar { display: flex; align-items: center; gap: 6px; min-height: 35px; padding: 7px 14px; border-bottom: 1px solid var(--perry-u-border); background: var(--perry-u-soft); color: var(--perry-u-muted); font-size: 11px; }
.perry-frame-bar::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #9caaaa; box-shadow: 11px 0 #b4b9a3, 22px 0 #a2b8ab; margin-right: 29px; }
.perry-frame > img { display: block; width: 100%; margin: 0 !important; }
.perry-frame-body { padding: 22px; }
.perry-embed { position: relative; padding: 25px; text-align: center; background: var(--perry-u-soft); }
.perry-embed iframe { display: block; width: 100%; min-height: 380px; border: 0; }
.perry-embed iframe:not([src]) { display: none; }
.perry-embed button { padding: 10px 15px; border: 1px solid var(--perry-u-border); border-radius: 8px; color: var(--perry-u-accent); background: var(--perry-u-paper); font: inherit; cursor: pointer; }
.perry-embed small, .perry-embed p { color: var(--perry-u-muted); font-size: 12px; }
.perry-dialogue { display: flex; flex-direction: column; gap: 16px; margin: 25px 0; }
.perry-dialogue-line { position: relative; align-self: flex-start; max-width: 88%; padding: 13px 17px; border: 1px solid var(--perry-u-border); border-radius: 3px 14px 14px 14px; background: var(--perry-u-soft); color: var(--perry-u-ink); line-height: 1.85; }
.perry-dialogue-line::before { content: attr(data-speaker); display: block; margin-bottom: 5px; color: var(--perry-u-muted); font-size: 10px; }
.perry-dialogue-line.is-answer { align-self: flex-end; border-radius: 14px 3px 14px 14px; background: rgba(92, 156, 155, .09); }
.perry-poetry { margin: 30px 0; padding: 30px 24px; border-block: 1px solid var(--perry-u-border); text-align: center; color: var(--perry-u-ink); background: var(--perry-u-soft); }
.perry-poetry p { font-family: 'STKaiti', 'KaiTi', 'FangSong', serif; font-size: 21px; line-height: 2.1; letter-spacing: .08em; }
.perry-poetry cite { color: var(--perry-u-muted); font-size: 12px; font-style: normal; }
.perry-poetry[lang='en'] p { font-family: var(--perry-display); font-size: 27px; font-style: italic; }
.perry-paper { margin: 25px 0; padding: 27px 29px 27px 39px; border: 1px solid var(--perry-u-border); border-radius: 3px 16px 16px 3px; background: repeating-linear-gradient(transparent, transparent 31px, rgba(121, 152, 172, .07) 31px, rgba(121, 152, 172, .07) 32px), var(--perry-u-paper); box-shadow: 4px 6px 0 var(--perry-u-soft); }
.perry-reel { margin: 30px 0; padding: 22px 27px; border-block: 7px solid var(--perry-u-border); border-radius: 10px; background: var(--perry-u-soft); line-height: 2; }
.perry-kbd, .perry-upgraded #article-container kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--perry-u-border); border-bottom-width: 2px; border-radius: 5px; background: var(--perry-u-soft); color: var(--perry-u-ink); font: 11px/1.6 Consolas, monospace; vertical-align: middle; }
.perry-mark { padding: 1px 3px; border-radius: 3px; background: rgba(160, 185, 125, .23); color: inherit; }
.perry-math, .perry-mermaid-diagram { max-width: 100%; margin: 22px 0; overflow-x: auto; overflow-y: hidden; }
.perry-math .katex-display { margin: 10px 0; padding: 6px 3px; }
.perry-mermaid-diagram svg { display: block; max-width: 100%; height: auto; margin-inline: auto; }
.perry-render-error { display: block; margin: 8px 0; padding: 10px 13px; border-left: 3px solid #ab956e; border-radius: 4px; color: var(--perry-u-muted); background: rgba(177, 151, 100, .1); font-size: 12px; line-height: 1.75; }
.perry-reveal { display: inline; padding: 3px 7px; border: 1px dashed var(--perry-u-border); border-radius: 4px; color: var(--perry-u-accent); background: var(--perry-u-soft); font: inherit; line-height: inherit; cursor: pointer; }
.perry-reveal-answer { display: none; }
.perry-reveal[aria-expanded='true'] > span:first-child { display: none; }
.perry-reveal[aria-expanded='true'] .perry-reveal-answer { display: inline; color: var(--perry-u-ink); }
.perry-upgraded :is(.perry-dock a, .perry-hero-search, .perry-wallpaper button, .perry-reader-tools button, .perry-carousel button, .perry-reveal, .perry-library-card, .perry-doc-nav a):focus-visible { outline: 2px solid var(--perry-u-accent); outline-offset: 3px; }
.perry-progress { position: fixed; top: 0; left: 0; z-index: 10010; width: 0; height: 2px; opacity: 0; pointer-events: none; background: #83b4c7; box-shadow: 0 0 8px rgba(115, 177, 205, .3); transition: width .3s ease, opacity .2s; }
.perry-progress.is-loading { opacity: .85; }
.perry-upgraded #article-container .tabs button[role='tab']:focus-visible { outline: 2px solid var(--perry-u-accent); outline-offset: -3px; }
.perry-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 900px) {
  body.perry-upgraded.research-galaxy-index #recent-posts > .recent-post-item { grid-template-columns: 180px minmax(0, 1fr); }
  .perry-doc-layout { grid-template-columns: 170px minmax(0, 1fr); gap: 20px; }
}
@media (max-width: 640px) {
  body.perry-upgraded.research-galaxy-index .galaxy-hero { min-height: 450px; padding-block: 26px; }
  body.perry-upgraded.research-galaxy-index .galaxy-hero h1 strong { font-size: 78px; }
  body.perry-upgraded.research-galaxy-index .galaxy-section { padding-top: 46px; }
  body.perry-upgraded.research-galaxy-index .galaxy-section-head { gap: 16px; }
  .perry-hero-search, .perry-dock { margin-left: 0; }
  .perry-dock { width: 100%; padding: 5px; gap: 1px; justify-content: space-around; }
  .perry-dock a { flex-direction: column; gap: 4px; padding: 7px 8px; font-size: 10px; }
  .perry-hero-search small { display: none; }
  body.perry-upgraded.research-galaxy-index #recent-posts > .recent-post-item { grid-template-columns: minmax(0, 1fr); }
  body.perry-upgraded.research-galaxy-index #recent-posts .post_cover { min-height: 0; height: 160px !important; }
  body.perry-upgraded.research-galaxy-index #recent-posts .recent-post-info { padding: 20px !important; }
  body.perry-upgraded.research-galaxy-index #recent-posts .article-title { font-size: 20px; }
  .perry-wallpaper { left: 10px; bottom: 10px; }
  .perry-wallpaper-toggle { min-height: 34px; padding: 7px 10px; font-size: 10px; }
  .perry-card-grid { grid-template-columns: 1fr; }
  .perry-panel, .perry-library-card, .perry-notebook-item, .perry-goal { padding: 19px; }
  .perry-doc-layout { grid-template-columns: 1fr; }
  body.perry-upgraded.perry-page-reading #page { padding: 22px 18px; }
  .perry-doc-nav { position: static; max-height: 280px; }
  .perry-dialogue-line { max-width: 95%; }
  .perry-poetry { padding-inline: 16px; }
  .perry-poetry p { font-size: 18px; }
  .perry-paper { padding: 22px; }
  .perry-frame-body { padding: 17px; }
  .perry-embed { padding: 15px; }
  .perry-embed iframe { min-height: 280px; }
}
@media (prefers-reduced-motion: reduce) {
  .perry-progress, .perry-carousel-slides, .perry-library-card { transition: none; scroll-behavior: auto; }
  body.perry-upgraded.research-galaxy-index .galaxy-hero::before,
  body.perry-upgraded.research-galaxy-index .galaxy-orbit-mark { transform: none; }
}
@media print {
  html, body.perry-upgraded, body.perry-upgraded #body-wrap, body.perry-upgraded #blog-container { color: #111 !important; background: #fff !important; }
  body.perry-upgraded #web_bg, body.perry-upgraded #nav, body.perry-upgraded #aside-content,
  body.perry-upgraded #rightside, body.perry-upgraded #footer, body.perry-upgraded #post-comment,
  body.perry-upgraded .perry-theme-switch, body.perry-upgraded .perry-wallpaper,
  body.perry-upgraded .perry-progress, body.perry-upgraded .perry-reader-tools,
  body.perry-upgraded .perry-doc-nav, body.perry-upgraded .post-series,
  body.perry-upgraded .relatedPosts, body.perry-upgraded #pagination,
  body.perry-upgraded .perry-carousel-controls { display: none !important; }
  body.perry-upgraded #page-header { height: auto !important; background: #fff !important; box-shadow: none !important; }
  body.perry-upgraded #post-info { position: static !important; padding: 12px 0 22px !important; color: #111 !important; }
  body.perry-upgraded #post-info .post-title, body.perry-upgraded #post-info #post-meta { color: #111 !important; }
  body.perry-upgraded #content-inner { display: block !important; width: 100% !important; padding: 0 !important; }
  body.perry-upgraded #post, body.perry-upgraded #page { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; background: #fff !important; }
  body.perry-upgraded #article-container { color: #111 !important; font-size: 11pt; line-height: 1.65; }
  body.perry-upgraded #article-container h1, body.perry-upgraded #page > h1 { font-size: 22pt !important; }
  body.perry-upgraded #article-container h2 { font-size: 16pt !important; }
  body.perry-upgraded #article-container h3 { font-size: 13pt !important; }
  body.perry-upgraded #article-container :is(figure.highlight,figure.highlight *,pre,pre *,code) { color: #222 !important; background: #fff !important; box-shadow: none !important; }
  body.perry-upgraded #article-container table { display: table; width: 100%; white-space: normal; }
  body.perry-upgraded #article-container :is(h1,h2,h3,h4,p,li,figcaption,blockquote) { color: #111 !important; }
  body.perry-upgraded #article-container img { max-height: 650px; max-width: 100%; object-fit: contain; break-inside: avoid; }
  body.perry-upgraded #article-container :is(figure,pre,table,.perry-resource-card) { break-inside: avoid; }
  body.perry-upgraded #article-container h2, body.perry-upgraded #article-container h3 { break-after: avoid; }
  body.perry-upgraded #article-container :is(.tabs .tab-item-content,.perry-carousel-slides > *) { display: block !important; height: auto !important; visibility: visible !important; }
  body.perry-upgraded #article-container .tabs .nav-tabs { display: none !important; }
  body.perry-upgraded .perry-carousel-slides, body.perry-upgraded .perry-doc-layout { display: block; overflow: visible; }
  body.perry-upgraded .perry-hub, body.perry-upgraded .perry-resource-card, body.perry-upgraded .perry-panel { color: #111 !important; background: #fff !important; box-shadow: none; }
  body.perry-upgraded #article-container a { color: #111 !important; text-decoration: underline; }
  body.perry-upgraded #article-container .perry-resource-card a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 9pt; overflow-wrap: anywhere; }
  body.perry-upgraded .perry-reveal-answer { display: inline; }
  body.perry-upgraded .perry-reveal > span:first-child { display: none; }
}
