/* =============================================================================
   CHAPTER READER - Prototype Aligned
   ============================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@400;500;700&display=swap');

body.single-fcn_chapter {
  padding: 0 !important;
}

body.single-fcn_chapter :is(
  .main-navigation,
  .top-header,
  .header,
  .header-background,
  .footer,
  .fcn-language-switcher,
  .smart-search,
  .mobile-bottom-nav,
  .nav-breadcrumbs
) {
  display: none !important;
}

.main.chapter {
  --ch-paper: #f7efe7;
  --ch-paper-border: #e6d9ca;
  --ch-paper-text: #2f2a26;
  --ch-muted: #7a6f66;
  --ch-surface: #ffffff;
  --ch-surface-border: #e2e8f0;
  --ch-accent: #ef4444;
  --ch-link: #2563eb;

  background: linear-gradient(180deg, #f9f5f1 0%, var(--ch-paper) 250px, var(--ch-paper) 100%);
  max-width: none !important;
  width: 100%;
  margin: 0 !important;
  padding-top: 1.2rem;
}

.main.chapter .main__background {
  display: none !important;
}

.ch-shell--standalone {
  max-width: 980px;
  width: min(980px, calc(100% - 3rem));
  margin: 0 auto;
}

.ch-reader-breadcrumbs {
  margin: 0 auto 1rem;
  max-width: 860px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.83rem;
  color: var(--ch-muted);
}

.ch-reader-breadcrumbs a {
  color: var(--ch-muted);
  text-decoration: none;
}

.ch-reader-breadcrumbs a:hover {
  color: var(--ch-link);
}

/* Floating toolbar */
.ch-toolbar {
  position: fixed;
  top: 50%;
  right: max(1.2rem, calc(50% - 580px));
  transform: translateY(-50%);
  z-index: 90;
  border-radius: 14px;
  border: 1px solid var(--ch-surface-border);
  background: var(--ch-surface);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ch-toolbar__btn {
  width: 58px;
  min-height: 54px;
  padding: 0.35rem 0.2rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  text-decoration: none;
  color: #475569;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ch-toolbar__btn svg {
  width: 1.2rem;
  height: 1.2rem;
}

.ch-toolbar__btn span {
  font-size: 0.63rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ch-toolbar__btn:hover {
  color: var(--ch-accent);
  background: #f8fafc;
  transform: translateY(-1px);
}

.ch-toolbar__divider {
  width: calc(100% - 0.75rem);
  height: 1px;
  margin: 0.15rem auto;
  background: #e2e8f0;
}

/* Title page */
.ch-title-page {
  margin: 0 auto 2rem;
  max-width: 860px;
  border: 1px solid var(--ch-paper-border);
  border-radius: 20px;
  padding: 2.6rem 1.2rem;
  background:
    radial-gradient(80% 120% at 50% 10%, rgba(239, 68, 68, 0.06) 0%, rgba(37, 99, 235, 0.03) 45%, transparent 100%),
    #fff9f4;
  text-align: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

.ch-title-page__cover {
  width: 154px;
  height: 216px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  margin: 0 auto 1.3rem;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.2);
}

.ch-title-page__name {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.65rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #201a15;
  font-weight: 800;
  font-family: 'Noto Serif SC', 'Inter', serif;
}

.ch-title-page__author {
  margin-top: 0.45rem;
  color: #7a6f66;
  font-size: 0.95rem;
}

.ch-title-page__stats {
  margin-top: 1.6rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.1rem;
}

.ch-title-page__stat {
  min-width: 138px;
  border-radius: 12px;
  border: 1px solid #e9dccd;
  background: rgba(255, 255, 255, 0.78);
  padding: 0.6rem 0.8rem;
}

.ch-title-page__stat-val {
  display: block;
  color: #2f2a26;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.15;
}

.ch-title-page__stat-label {
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a6f66;
}

.ch-title-page__community {
  margin-top: 1.35rem;
  font-size: 0.95rem;
  color: #514941;
}

.ch-title-page__publisher {
  margin-top: 1.15rem;
  font-size: 0.76rem;
  color: #8a7f75;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Chapter article */
.chapter__article {
  max-width: 860px;
  margin: 0 auto;
}

.chapter__headline {
  margin-top: 1rem;
  text-align: center;
}

.chapter__headline .chapter__story-link {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  color: #6b7280;
  text-decoration: none;
}

.chapter__headline .chapter__story-link:hover {
  color: var(--ch-link);
}

.chapter__title {
  margin-top: 0.65rem;
  margin-bottom: 0.45rem;
  font-family: 'Noto Serif SC', 'Inter', serif;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  line-height: 1.25;
  color: #1f1a16;
}

.chapter__author {
  font-size: 0.88rem;
  color: #7a6f66;
  font-style: normal;
}

.chapter__actions {
  margin: 0.9rem auto 0;
  border-radius: 14px;
  border: 1px solid #e8ded2;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 0.35rem;
  max-width: 860px;
}

.chapter__actions .button {
  border-radius: 10px;
}

.chapter__content {
  margin-top: 1.2rem;
  border: 1px solid var(--ch-paper-border);
  border-radius: 18px;
  background: #fff9f4;
  box-shadow: 0 4px 15px rgba(15, 23, 42, 0.06);
  padding: clamp(1.2rem, 2.3vw, 2rem) clamp(1rem, 2.4vw, 2.3rem);
  color: var(--ch-paper-text);
  font-family: 'Noto Serif SC', 'Georgia', serif;
  line-height: 1.95;
}

.chapter__content p {
  font-size: 1.23rem;
  text-indent: 2.4em;
  margin: 0 0 1.1em;
  color: #38312c;
}

.chapter__content p:last-child {
  margin-bottom: 0;
}

.chapter__content .selected-paragraph {
  background: rgba(37, 99, 235, 0.06);
  border-radius: 6px;
}

/* Reactions */
.ch-reactions {
  margin-top: 2.2rem;
  border-top: 1px solid #dfd1c2;
  padding-top: 1.9rem;
  text-align: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ch-reactions__title {
  color: #2c2520;
  font-size: clamp(1.55rem, 2.2vw, 2.1rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.55rem;
}

.ch-reactions__hint {
  margin: 0 0 1.35rem;
  color: #6f655d;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ch-reactions__grid {
  margin: 0 auto;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.05rem 1.45rem;
}

.ch-reaction-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.ch-reaction-item__btn {
  border: 1px solid #dfd2c4;
  border-radius: 999px;
  background: #eef2f8;
  color: #253047;
  width: 100%;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.45rem 0.9rem;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.ch-reaction-item__emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.ch-reaction-item__count {
  font-size: 1.95rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ch-reaction-item__btn:hover {
  border-color: #93c5fd;
  color: #1e3a8a;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(30, 58, 138, 0.08);
  transform: translateY(-1px);
}

.ch-reaction-item._active .ch-reaction-item__btn {
  border-color: #93c5fd;
  color: #1e3a8a;
  background: #eff6ff;
}

.ch-reaction-item__label {
  font-size: 0.72rem;
  line-height: 1.2;
  color: #433b34;
  font-weight: 500;
}

/* Guide modal */
.ch-guide-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 102;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(4px);
}

.ch-guide-modal._open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch-guide-modal__panel {
  width: min(860px, calc(100% - 2rem));
  max-height: min(86vh, 900px);
  border-radius: 18px;
  border: 1px solid #d7cbbf;
  background: #fbf6ef;
  box-shadow: 0 26px 45px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ch-guide-modal__header {
  padding: 1.05rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e6dbcf;
}

.ch-guide-modal__title {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.3;
  color: #2f2924;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.ch-guide-modal__close {
  border: none;
  background: #f2ebe2;
  color: #5f554d;
  border-radius: 10px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ch-guide-modal__close:hover {
  color: #be123c;
  background: #ffe4e6;
}

.ch-guide-modal__close svg {
  width: 1rem;
  height: 1rem;
}

.ch-guide-modal__content {
  padding: 1rem 1rem 1.1rem;
  overflow-y: auto;
}

.ch-guide-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

.ch-guide-controls--secondary {
  margin-top: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ch-guide-controls__item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ch-guide-controls__label {
  color: #756c63;
  font-size: 0.92rem;
  line-height: 1.3;
  font-weight: 600;
}

.ch-guide-keycap-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ch-guide-keycap {
  border-radius: 14px;
  border: 1px solid #c9c3bb;
  background: #f8fafc;
  min-width: 64px;
  min-height: 56px;
  padding: 0.35rem 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4a4a4a;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.06);
}

.ch-guide-keycap--small {
  min-width: 72px;
  min-height: 50px;
  font-size: 1.15rem;
}

.ch-guide-bookmark {
  margin-top: 1.05rem;
}

.ch-guide-bookmark__title {
  display: block;
  margin-bottom: 0.45rem;
  color: #756c63;
  font-size: 0.96rem;
  font-weight: 600;
}

.ch-guide-bookmark__panel {
  border: 1px solid #e5ddd3;
  border-radius: 14px;
  background: #f7f8fb;
  padding: 1rem;
}

.ch-guide-bookmark__tabs {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  color: #999;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
}

.ch-guide-bookmark__tabs span {
  position: relative;
}

.ch-guide-bookmark__tabs ._active {
  color: #ef4444;
}

.ch-guide-bookmark__tabs ._active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -0.45rem;
  width: 20px;
  height: 3px;
  border-radius: 99px;
  transform: translateX(-50%);
  background: #ef4444;
}

.ch-guide-bookmark__meta {
  margin-top: 0.45rem;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: #9c9895;
  font-size: 1.35rem;
  line-height: 1;
}

.ch-guide-bookmark__progress {
  color: #ef4444;
}

.ch-guide-bookmark__dot {
  color: #b8b3af;
}

.ch-guide-switch {
  margin-top: 0.95rem;
}

.ch-guide-switch__hint {
  margin: 0 0 0.55rem;
  color: #6f655d;
  font-size: 0.9rem;
  line-height: 1.45;
}

.ch-guide-switch__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 0.8rem;
}

.ch-guide-switch__mock {
  border: 1px solid #e5ddd3;
  border-radius: 14px;
  background: #f7f8fb;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.ch-guide-switch__column {
  padding: 0.9rem 1rem;
}

.ch-guide-switch__column:first-child {
  border-right: 1px solid #e5ddd3;
}

.ch-guide-switch__column h4 {
  margin: 0 0 0.65rem;
  color: #999;
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 700;
}

.ch-guide-switch__keys {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.ch-guide-switch__key-label {
  color: #756c63;
  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 600;
}

.ch-guide-skeleton {
  border-radius: 4px;
  background: #e2e2e5;
}

.ch-guide-skeleton--line {
  margin-top: 0.5rem;
  height: 10px;
}

.ch-guide-skeleton--bar {
  margin-top: 0.58rem;
  height: 18px;
}

.ch-guide-skeleton--block {
  height: 54px;
  border-radius: 6px;
  margin-bottom: 0.45rem;
}

.ch-guide-skeleton--line.short {
  width: 80%;
}

.ch-guide-skeleton--comment {
  margin-bottom: 0.4rem;
  height: 12px;
  width: 88%;
}

.ch-guide-skeleton--comment:last-child {
  margin-bottom: 0;
  width: 82%;
}

.ch-guide-switch__keys .ch-guide-keycap {
  width: 100%;
  min-width: 0;
  min-height: 46px;
}

.ch-guide-switch__keys .ch-guide-keycap:nth-child(5) {
  min-height: 36px;
  font-size: 1rem;
}

.ch-guide-bookmark__panel .ch-guide-skeleton--line {
  width: 38%;
  border-radius: 3px;
}

.ch-guide-bookmark__panel .ch-guide-skeleton--bar {
  width: 100%;
  border-radius: 3px;
}

/* TOC modal */
.ch-toc-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 101;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.ch-toc-modal._open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ch-toc-modal__panel {
  width: min(840px, calc(100% - 2rem));
  max-height: min(78vh, 840px);
  border-radius: 18px;
  border: 1px solid #dbe4f2;
  background: #ffffff;
  box-shadow: 0 26px 45px rgba(15, 23, 42, 0.23);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ch-toc-modal__header {
  padding: 1rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #e5edf8;
}

.ch-toc-modal__title {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.3;
  color: #1f2937;
  font-weight: 800;
}

.ch-toc-modal__close {
  border: none;
  background: #f8fafc;
  color: #475569;
  border-radius: 10px;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ch-toc-modal__close:hover {
  color: #ef4444;
  background: #fef2f2;
}

.ch-toc-modal__close svg {
  width: 1rem;
  height: 1rem;
}

.ch-toc-modal__grid {
  padding: 1rem;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
}

.ch-toc-modal__item {
  border-radius: 9px;
  border: 1px solid #e4ecf8;
  background: #fbfdff;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-toc-modal__item:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.ch-toc-modal__item._current {
  border-color: #fda4af;
  color: #be123c;
  background: #fff1f2;
  font-weight: 700;
}

/* Dark mode */
[data-mode='dark'] .main.chapter {
  --ch-paper: #0f1a2d;
  --ch-paper-border: #2c3c57;
  --ch-paper-text: #d3deed;
  --ch-muted: #91a1bb;
  --ch-surface: #15243b;
  --ch-surface-border: #2c3c57;

  background: linear-gradient(180deg, #0c1424 0%, #0f1a2d 260px, #0f1a2d 100%);
}

[data-mode='dark'] .ch-reader-breadcrumbs,
[data-mode='dark'] .ch-reader-breadcrumbs a,
[data-mode='dark'] .ch-title-page__author,
[data-mode='dark'] .ch-title-page__community,
[data-mode='dark'] .ch-title-page__publisher,
[data-mode='dark'] .chapter__author,
[data-mode='dark'] .ch-reaction-item__label,
[data-mode='dark'] .ch-reactions__hint {
  color: #91a1bb;
}

[data-mode='dark'] .ch-toolbar {
  border-color: #31435f;
  background: #15243b;
  box-shadow: none;
}

[data-mode='dark'] .ch-toolbar__btn {
  color: #b9c8dd;
}

[data-mode='dark'] .ch-toolbar__btn:hover {
  background: #1b2d49;
  color: #fda4af;
}

[data-mode='dark'] .ch-toolbar__divider {
  background: #31435f;
}

[data-mode='dark'] .ch-title-page,
[data-mode='dark'] .chapter__content,
[data-mode='dark'] .chapter__actions {
  border-color: #31435f;
  background: #121f34;
  box-shadow: none;
}

[data-mode='dark'] .ch-title-page__name,
[data-mode='dark'] .ch-title-page__stat-val,
[data-mode='dark'] .chapter__title,
[data-mode='dark'] .chapter__content p,
[data-mode='dark'] .ch-reactions__title {
  color: #d3deed;
}

[data-mode='dark'] .ch-title-page__stat {
  border-color: #31435f;
  background: #172942;
}

[data-mode='dark'] .ch-title-page__stat-label {
  color: #91a1bb;
}

[data-mode='dark'] .chapter__headline .chapter__story-link {
  color: #91a1bb;
}

[data-mode='dark'] .chapter__headline .chapter__story-link:hover {
  color: #93c5fd;
}

[data-mode='dark'] .chapter__content .selected-paragraph {
  background: rgba(147, 197, 253, 0.09);
}

[data-mode='dark'] .ch-reactions {
  border-color: #3a4e6f;
}

[data-mode='dark'] .ch-reaction-item__btn {
  border-color: #3a4e6f;
  background: #172942;
  color: #b9c8dd;
}

[data-mode='dark'] .ch-reaction-item__btn:hover {
  border-color: #60a5fa;
  color: #dbeafe;
  background: #1d3150;
}

[data-mode='dark'] .ch-reaction-item._active .ch-reaction-item__btn {
  border-color: #60a5fa;
  color: #dbeafe;
  background: #1b365b;
}

[data-mode='dark'] .ch-guide-modal__panel {
  border-color: #31435f;
  background: #15243b;
}

[data-mode='dark'] .ch-guide-modal__header {
  border-color: #2f4160;
}

[data-mode='dark'] .ch-guide-modal__title,
[data-mode='dark'] .ch-guide-switch__column h4,
[data-mode='dark'] .ch-guide-bookmark__tabs {
  color: #d3deed;
}

[data-mode='dark'] .ch-guide-controls__label,
[data-mode='dark'] .ch-guide-bookmark__title,
[data-mode='dark'] .ch-guide-switch__key-label,
[data-mode='dark'] .ch-guide-switch__hint,
[data-mode='dark'] .ch-guide-bookmark__meta {
  color: #9cb0ca;
}

[data-mode='dark'] .ch-guide-keycap,
[data-mode='dark'] .ch-guide-bookmark__panel,
[data-mode='dark'] .ch-guide-switch__mock {
  border-color: #31435f;
  background: #172942;
  color: #d3deed;
}

[data-mode='dark'] .ch-guide-skeleton {
  background: #2d3e5d;
}

[data-mode='dark'] .ch-guide-bookmark__tabs ._active,
[data-mode='dark'] .ch-guide-bookmark__progress {
  color: #fb7185;
}

[data-mode='dark'] .ch-guide-bookmark__dot {
  color: #6f86a8;
}

[data-mode='dark'] .ch-guide-switch__column:first-child {
  border-color: #31435f;
}

[data-mode='dark'] .ch-guide-modal__close {
  background: #1b2d49;
  color: #a9bdd9;
}

[data-mode='dark'] .ch-guide-modal__close:hover {
  color: #fecdd3;
  background: rgba(190, 24, 93, 0.2);
}

[data-mode='dark'] .ch-toc-modal__panel {
  border-color: #31435f;
  background: #15243b;
}

[data-mode='dark'] .ch-toc-modal__header {
  border-color: #2f4160;
}

[data-mode='dark'] .ch-toc-modal__title,
[data-mode='dark'] .ch-toc-modal__item {
  color: #c8d5e9;
}

[data-mode='dark'] .ch-toc-modal__item {
  border-color: #31435f;
  background: #172942;
}

[data-mode='dark'] .ch-toc-modal__item:hover {
  border-color: #5d88c7;
  color: #bfdbfe;
}

[data-mode='dark'] .ch-toc-modal__item._current {
  border-color: #fda4af;
  background: rgba(190, 24, 93, 0.15);
  color: #fecdd3;
}

[data-mode='dark'] .ch-toc-modal__close {
  background: #1b2d49;
  color: #a9bdd9;
}

[data-mode='dark'] .ch-toc-modal__close:hover {
  color: #fecdd3;
  background: rgba(190, 24, 93, 0.2);
}

/* Responsive */
@media only screen and (max-width: 1120px) {
  .ch-toolbar {
    right: 0.85rem;
  }
}

@media only screen and (max-width: 900px) {
  .ch-shell--standalone {
    width: calc(100% - 1.6rem);
  }

  .chapter__content p {
    font-size: 1.12rem;
  }

  .ch-toc-modal__grid {
    grid-template-columns: 1fr;
  }

  .ch-reactions__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.9rem;
  }

  .ch-guide-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ch-guide-controls--secondary {
    grid-template-columns: 1fr;
  }

  .ch-guide-switch__layout {
    grid-template-columns: 1fr;
  }

  .ch-guide-switch__keys {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .ch-guide-switch__key-label {
    grid-column: span 3;
  }

  .ch-toolbar {
    position: fixed;
    top: auto;
    right: 0.65rem;
    bottom: 0.75rem;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    width: min(360px, calc(100% - 1.3rem));
    justify-content: center;
    border-radius: 16px;
    padding: 0.4rem;
    gap: 0.25rem;
  }

  .ch-toolbar__btn {
    width: 52px;
    min-height: 46px;
  }

  .ch-toolbar__btn span {
    font-size: 0.58rem;
  }

  .ch-toolbar__divider {
    display: none;
  }
}

@media only screen and (max-width: 640px) {
  .ch-title-page {
    padding: 1.8rem 0.9rem;
  }

  .ch-title-page__stats {
    gap: 0.6rem;
  }

  .ch-title-page__stat {
    min-width: 118px;
  }

  .chapter__content {
    padding: 1.1rem 0.9rem;
  }

  .chapter__content p {
    font-size: 1.03rem;
    text-indent: 2em;
  }

  .ch-guide-modal__title {
    font-size: 1.65rem;
  }

  .ch-guide-controls {
    grid-template-columns: 1fr;
  }

  .ch-guide-bookmark__tabs {
    font-size: 1.55rem;
  }

  .ch-guide-bookmark__meta {
    font-size: 1.25rem;
  }

  .ch-guide-switch__column h4 {
    font-size: 1.35rem;
  }

  .ch-reactions__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .ch-reaction-item__btn {
    min-height: 2.45rem;
    font-size: 0.95rem;
  }

  .ch-reaction-item__count {
    font-size: 1.55rem;
  }
}
