/*
 * Читалка «Тринадцати этажей» — оформление (макет Kniga-Chitalka из проекта Claude Design).
 * Геометрию колонок и панелей считает reader.js, здесь — всё остальное. Цвета темы приходят
 * переменными на #reader.
 */
html,
body.rd-body {
  margin: 0;
  height: 100%;
}
body.rd-body {
  background: #f7f6f1;
  font-family: Onest, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#reader {
  --bg: #f7f6f1;
  --fg: #1b1a17;
  --sub: #6b6a63;
  --rule: #dfded6;
  --panel: #fff;
  --chip: #ffe100;
  --chipfg: #0e0e0c;
  --acc: #0e0e0c;
  --tts: rgba(255, 225, 0, .28);
  position: fixed;
  inset: 0;
  background: var(--bg);
  color: var(--fg);
  overflow-x: hidden;
  transition: background .25s, color .25s;
}
#reader *,
#reader *::before,
#reader *::after {
  box-sizing: border-box;
}
#reader a {
  color: inherit;
  text-decoration: none;
}
#reader button {
  font-family: inherit;
  color: inherit;
}
#reader ::selection {
  background: rgba(255, 225, 0, .55);
  color: inherit;
}
#reader input[type="range"] {
  accent-color: var(--acc);
}
.mono {
  font-family: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

/* страница */
.rd-stage {
  position: absolute;
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.rd-scroll .rd-stage {
  position: relative;
  overflow: visible;
}
.rd-box {
  max-width: 100%;
  position: relative;
}
.rd-flow {
  position: relative;
  column-fill: auto;
  hyphens: auto;
  -webkit-hyphens: auto;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
}
.rd-head {
  break-inside: avoid;
  margin-bottom: 2.4em;
  text-align: left;
  hyphens: manual;
}
.rd-head .k1 {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--sub);
  margin-bottom: 1.4em;
}
.rd-head .k2 {
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  letter-spacing: .14em;
  margin-bottom: .4em;
}
.rd-head .ttl {
  font-family: Tektur, "Arial Narrow", sans-serif;
  font-weight: 900;
  font-stretch: 75%;
  font-size: 2.6em;
  line-height: .95;
  text-transform: uppercase;
  margin-bottom: .6em;
  overflow-wrap: anywhere;
}
.rd-flow p {
  margin: 0;
  orphans: 2;
  widows: 2;
  transition: background .3s;
}
.rd-flow p.tts {
  background: var(--tts);
}
.rd-flow .brk {
  text-align: center;
  letter-spacing: .8em;
  margin: 1.2em 0;
  color: var(--sub);
  text-indent: 0;
  break-after: avoid;
}
.rd-flow .hl {
  border-radius: 1px;
}
.rd-flow .nt {
  margin-left: .35em;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px 0;
  background: var(--chip);
  color: var(--chipfg);
  border: 0;
  vertical-align: .18em;
  cursor: pointer;
  line-height: 1.5;
  text-indent: 0;
}
.rd-end {
  break-inside: avoid;
  text-align: left;
  padding-top: 3em;
  hyphens: manual;
}
.rd-end .k1 {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: .14em;
  color: var(--sub);
  margin-bottom: 1em;
}
.rd-next {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: #0e0e0c;
  color: #ffe100;
  border: 0;
  font-family: Tektur, sans-serif;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  clip-path: polygon(0 0, 100% 0, 100% 70%, calc(100% - 14px) 100%, 0 100%);
  text-align: left;
}
#reader .rd-next {
  color: #ffe100;
}

/* прогресс и панели */
.rd-prog {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  z-index: 26;
  background: var(--rule);
}
.rd-prog i {
  display: block;
  height: 3px;
  background: var(--acc);
  transition: width .3s;
}
.rd-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  width: 48px;
  height: 96px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-arrow:hover,
.rd-tb:hover,
.rd-rl:hover {
  background: #ffe100;
  color: #0e0e0c !important;
}
.rd-rail {
  position: fixed;
  top: 3px;
  bottom: 0;
  width: 64px;
  z-index: 22;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: opacity .25s;
}
.rd-rail:hover {
  opacity: 1 !important;
}
.rd-rail.l {
  left: 0;
  border-right: 1px solid var(--rule);
}
.rd-rail.r {
  right: 0;
  border-left: 1px solid var(--rule);
}
.rd-rail .logo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  border-bottom: 1px solid var(--rule);
}
.rd-rail .logo i {
  width: 22px;
  height: 22px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}
.rd-rail .pg {
  height: 56px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--sub);
}
.rd-rail .vert {
  margin-top: auto;
  padding: 12px 0 16px;
  display: flex;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  color: var(--sub);
}
.rd-rail .vert span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: .12em;
  white-space: nowrap;
}
.rd-rl,
.rd-tb {
  border: 0;
  cursor: pointer;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.rd-rl {
  height: 56px;
}
.rd-rl.on,
.rd-tb.on {
  background: #ffe100;
  color: #0e0e0c;
}
.rd-corner {
  position: fixed;
  width: 44px;
  height: 44px;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: transparent;
  z-index: 14;
  transition: top .2s;
}
.rd-corner span {
  position: absolute;
  top: 0;
  right: 0;
  width: 26px;
  height: 26px;
  background: var(--rule);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  transition: background .2s;
}
.rd-corner.on span {
  background: #ffe100;
}
.rd-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 24;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .04em;
  max-width: 94vw;
}
.rd-pill.back {
  background: #0e0e0c;
  color: #efeee9;
}
.rd-pill.back button {
  height: 40px;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
  color: #ffe100;
  padding: 0 14px;
}
.rd-pill.back button + button {
  width: 36px;
  padding: 0;
  border-left: 1px solid #3a3935;
  color: #efeee9;
}
.rd-pill.res {
  background: #ffe100;
  color: #0e0e0c;
}
.rd-pill.res span {
  padding: 0 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-pill.res button {
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-left: 1.5px solid #0e0e0c;
  background: none;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  color: #0e0e0c;
}
.rd-chrome {
  position: fixed;
  z-index: 20;
  background: var(--bg);
  transition: opacity .2s, transform .2s;
}
.rd-chrome.top {
  top: 3px;
  border-bottom: 1px solid var(--rule);
}
.rd-chrome.bot {
  bottom: 0;
  border-top: 1px solid var(--rule);
}
.rd-chrome.off {
  opacity: 0;
  pointer-events: none;
}
.rd-chrome.top.off {
  transform: translateY(-8px);
}
.rd-chrome.bot.off {
  transform: translateY(8px);
}
.rd-hz {
  height: 5px;
  background: repeating-linear-gradient(-45deg, #ffe100 0 9px, #0e0e0c 9px 18px);
}
.rd-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px clamp(8px, 2vw, 20px);
}
.rd-top .back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex: 0 0 auto;
}
.rd-top .back:hover {
  background: #ffe100;
  color: #0e0e0c;
}
.rd-top .tt {
  flex: 1;
  min-width: 0;
  padding: 0 6px;
}
.rd-top .tt .a {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
  color: var(--sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-top .tt .b {
  font-family: Tektur, sans-serif;
  font-weight: 800;
  font-stretch: 75%;
  font-size: 17px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-tb {
  width: 40px;
  height: 40px;
}
.rd-music {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--rule);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .06em;
  flex-wrap: wrap;
}
.rd-music i {
  width: 8px;
  height: 8px;
  background: #ffe100;
  box-shadow: 0 0 0 2px #0e0e0c;
}
.rd-music input {
  width: 120px;
}
.rd-music button {
  margin-left: auto;
  border: 1.5px solid currentColor;
  background: none;
  font-family: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}
.rd-scrub {
  padding: 10px clamp(12px, 3vw, 28px) 12px;
}
.rd-scrub input {
  width: 100%;
  margin: 0 0 6px;
}
.rd-scrub div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--sub);
  flex-wrap: wrap;
}
.rd-pageno {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--sub);
  pointer-events: none;
  bottom: 0;
}
.rd-hint {
  position: fixed;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 25;
  background: #0e0e0c;
  color: #efeee9;
  padding: 10px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .04em;
  pointer-events: none;
  max-width: 94vw;
  text-align: center;
}
.rd-sel {
  position: fixed;
  z-index: 40;
  background: #0e0e0c;
  color: #efeee9;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  max-width: 96vw;
  flex-wrap: wrap;
  justify-content: center;
}
.rd-sel button {
  border: 0;
  background: none;
  cursor: pointer;
  color: #efeee9;
}
.rd-sel .c {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rd-sel .c i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #efeee9;
}
.rd-sel .a {
  height: 32px;
  padding: 0 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .06em;
  white-space: nowrap;
}
.rd-sel .a:hover {
  background: #ffe100;
  color: #0e0e0c;
}
.rd-sel .sep {
  width: 1px;
  height: 22px;
  background: #3a3935;
  margin: 0 4px;
}

/* боковая панель */
.rd-shade {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, .35);
  z-index: 29;
}
.rd-panel {
  position: fixed;
  z-index: 30;
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 0 40px rgba(14, 14, 12, .14);
  display: flex;
  flex-direction: column;
}
.rd-panel .ph {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule);
}
.rd-panel .ph div {
  flex: 1;
  font-family: Tektur, sans-serif;
  font-weight: 800;
  font-stretch: 75%;
  font-size: 22px;
  text-transform: uppercase;
  line-height: 1.1;
}
.rd-panel .ph button {
  width: 36px;
  height: 36px;
  border: 1.5px solid currentColor;
  background: none;
  cursor: pointer;
  font-size: 15px;
}
.rd-panel .pb {
  flex: 1;
  overflow: auto;
  padding: 16px 18px 28px;
}
.lbl {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--sub);
  margin-bottom: 8px;
}
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}
.tabs button,
.seg button {
  flex: 1;
  height: 36px;
  border: 1.5px solid var(--rule);
  background: transparent;
  cursor: pointer;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .06em;
}
.seg button {
  height: 40px;
  font-family: Onest, sans-serif;
  font-size: 13.5px;
  white-space: nowrap;
}
.tabs button.on,
.seg button.on,
.fonts button.on {
  background: #0e0e0c;
  border-color: #0e0e0c;
  color: #ffe100;
}
.seg {
  display: flex;
  gap: 4px;
}
.themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.themes button {
  height: 64px;
  border: 2px solid var(--rule);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.themes button.on {
  border-color: #ffe100;
}
.themes b {
  font-family: Literata, serif;
  font-size: 20px;
  font-weight: 400;
}
.themes small {
  font-family: "JetBrains Mono", monospace;
  font-size: 9.5px;
  letter-spacing: .06em;
}
.fonts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.fonts button {
  height: 48px;
  border: 1.5px solid var(--rule);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}
.sizer {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sizer button {
  width: 48px;
  height: 44px;
  border: 1.5px solid currentColor;
  background: none;
  cursor: pointer;
  font-family: Literata, serif;
}
.sizer input {
  flex: 1;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  cursor: pointer;
}
.chk input {
  width: 18px;
  height: 18px;
  accent-color: #0e0e0c;
}
.toc button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 8px;
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-family: Onest, sans-serif;
  font-size: 15px;
}
.toc button.cur {
  background: #ffe100;
  color: #0e0e0c;
  font-weight: 700;
}
.toc button.main {
  font-weight: 700;
}
.toc button span:first-child {
  flex: 1;
}
.toc button span + span {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .06em;
  opacity: .75;
  white-space: nowrap;
}
.li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.li > button:first-child {
  flex: 1;
  text-align: left;
  border: 0;
  background: none;
  cursor: pointer;
  padding: 0;
}
.li > button:last-child {
  border: 0;
  background: none;
  color: var(--sub);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}
.li .m {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--sub);
}
.li .q {
  font-family: Literata, serif;
  font-size: 14.5px;
  line-height: 1.45;
  margin-top: 3px;
}
.li .n {
  font-size: 14px;
  margin-top: 4px;
  font-style: italic;
}
.li .bar {
  flex: 0 0 4px;
  align-self: stretch;
}
.empty {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--sub);
}
.pbtn {
  height: 44px;
  background: #0e0e0c;
  color: #ffe100 !important;
  border: 0;
  font-family: Tektur, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}
.ghostb {
  margin-top: 14px;
  height: 40px;
  padding: 0 14px;
  border: 1.5px solid currentColor;
  background: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  letter-spacing: .06em;
  cursor: pointer;
}
.srch {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--fg);
  font-family: Onest, sans-serif;
  font-size: 16px;
  margin-bottom: 12px;
}
.ta {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--sub);
  font-family: Onest, sans-serif;
  font-size: 15px;
  resize: vertical;
}
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}
.cards > div {
  padding: 14px;
  border: 1.5px solid var(--rule);
}
.cards b {
  display: block;
  font-family: Tektur, sans-serif;
  font-weight: 900;
  font-stretch: 75%;
  font-size: 30px;
  line-height: 1;
}
.cards span {
  display: block;
  font-size: 13px;
  color: var(--sub);
  margin-top: 6px;
}
.days {
  display: grid;
  grid-template-columns: repeat(14, 1fr);
  gap: 3px;
}
.days div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: var(--sub);
}
.days i {
  width: 100%;
  aspect-ratio: 1;
}
mark.f {
  background: #ffe100;
  color: #0e0e0c;
}

#reader [hidden] {
  display: none !important;
}
