/* Sichos Kodesh — vol. 1 reader */

:root {
  --page: #FBF8F2;
  --ink: #111111;
  --mute: #5A5854;
  --rule: #C8C4BC;
  --mark: #7A1F2B;
  --grade-none: #C8C4BC;
  --grade-bad: #6B1216;
  --grade-rough: #8A5720;
  --grade-ok: #111111;
  --grade-good: #3E5640;
  --grade-verified: #7A1F2B;
  --measure: 40rem;
  --ui: "Source Sans 3", system-ui, "Segoe UI", sans-serif;
  --sefer: "Frank Ruhl Libre", "Times New Roman", serif;
  --type: "Miriam Libre Local", "Miriam Libre", serif;
}

@font-face {
  font-family: "Miriam Libre Local";
  src: url("/fonts/MiriamLibre-Static-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Miriam Libre Local";
  src: url("/fonts/MiriamLibre-Static-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--page);
  color: var(--ink);
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: #E8D0D3;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: var(--rule);
}

a:hover {
  text-decoration-color: var(--ink);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid var(--mark);
  outline-offset: 2px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
}

input,
textarea,
select {
  border-radius: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Home — the volume title page on the table                            */
/* ------------------------------------------------------------------ */

body.home {
  min-height: 100vh;
}

.cover {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem 1rem 1.75rem;
}

.cover-scan {
  margin: 0;
  max-width: min(26rem, 100%);
}

.cover-scan img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(72vh, 40rem);
  object-fit: contain;
}

.cover-meta {
  margin: 1.1rem 0 0;
  font-size: 0.88rem;
  color: var(--mute);
}

.cover-meta [lang="he"] {
  font-family: var(--sefer);
  font-size: 1.02em;
}

.cover .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-top: 0.7rem;
  gap: 0.15rem 0;
  font-size: 0.95rem;
}

.cover .links a {
  text-decoration: none;
  padding: 0.15rem 0.7rem;
}

.cover .links a:hover {
  text-decoration: underline;
  text-decoration-color: var(--ink);
}

.cover .links a + a::before {
  content: "·";
  display: inline-block;
  margin-inline-end: 0.7rem;
  color: var(--mute);
}

/* ------------------------------------------------------------------ */
/* Shared top bar                                                       */
/* ------------------------------------------------------------------ */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem 0.85rem;
  min-height: 2.15rem;
  padding: 0.28rem 0.9rem;
  background: var(--page);
  border-bottom: 1px solid var(--ink);
  font-family: var(--ui);
  font-size: 0.82rem;
}

.bar-brand {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
}

.bar-brand a {
  font-family: var(--sefer);
  font-size: 1.05rem;
  text-decoration: none;
  line-height: 1.2;
}

.bar-brand a:hover {
  text-decoration: none;
  color: var(--mark);
}

.bar-view {
  display: flex;
  gap: 0.85rem;
}

.bar-page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12rem;
  margin-inline-start: auto;
}

.view-btn {
  padding: 0.05rem 0 0.1rem;
  border-bottom: 1px solid transparent;
  font-size: 0.82rem;
  color: var(--mute);
}

.view-btn.is-active {
  color: var(--ink);
  border-bottom-color: var(--mark);
}

.step {
  width: 1.55rem;
  height: 1.55rem;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--ink);
}

.step:disabled {
  color: var(--rule);
  cursor: default;
}

#page-input {
  width: 2.35rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0.08rem 0 0.04rem;
  text-align: center;
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

#page-input::-webkit-outer-spin-button,
#page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#page-input:hover {
  border-bottom-color: var(--rule);
}

.bar-print {
  min-width: 1.05em;
  margin-inline-start: 0.1rem;
  font-family: var(--sefer);
  font-size: 0.88rem;
  color: var(--mute);
}

.bar-note {
  margin-inline-start: auto;
  font-size: 0.82rem;
  color: var(--mute);
}

.bar-note a {
  text-decoration: none;
}

.bar-ctl {
  padding: 0.05rem 0 0.1rem;
  border-bottom: 1px solid transparent;
  font-size: 0.82rem;
  color: var(--mute);
}

.bar-ctl:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

#open-contents {
  font-family: var(--sefer);
  font-size: 0.95rem;
  color: var(--ink);
}

.bar-note-ctl {
  margin-inline-start: 0.75rem;
}

/* ------------------------------------------------------------------ */
/* Reader                                                               */
/* ------------------------------------------------------------------ */

body.reader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chrome {
  flex-shrink: 0;
  background: var(--page);
}

.chrome .bar {
  border-bottom: 0;
}

.stage {
  flex: 1 1 auto;
}

.scan-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.9rem 1rem;
}

.scan-stage img {
  display: block;
  max-height: calc(100vh - 7.2rem);
  max-width: min(100%, 1400px);
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ------------------------------------------------------------------ */
/* Both — one scroll; retype is the leaf; ink is a follow-along strip   */
/* ------------------------------------------------------------------ */

body.reader.is-both .chrome {
  position: sticky;
  top: 0;
  z-index: 8;
}

body.reader.is-both .stage,
body.reader.is-both .both,
body.reader.is-both .both-leaf,
body.reader.is-both .both-leaf * {
  touch-action: pan-y;
}

body.reader.is-peeking {
  overflow: hidden;
}

.both-ink {
  position: sticky;
  top: var(--chrome-h, 5.4rem);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32vh;
  max-height: 36vh;
  min-height: 6.5rem;
  padding: 0.15rem 0.55rem;
  overflow: hidden;
  background: var(--page);
  border-bottom: 1px solid var(--rule);
  touch-action: pan-y;
  user-select: none;
}

.both-ink.is-zoomed {
  touch-action: none;
}

.both-ink-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
}

.both-leaf .quiet {
  margin-block: 2.4rem;
}

.both-peek {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.4rem 0.75rem 1rem;
  background: var(--page);
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
}

.both-peek[hidden] {
  display: none !important;
}

.both-peek img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 3.2rem);
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.both-peek.is-zoomed img {
  cursor: grab;
}

.both-peek.is-zoomed img:active {
  cursor: grabbing;
}

.both-peek-close {
  position: absolute;
  top: 0.55rem;
  inset-inline-end: 0.9rem;
  z-index: 2;
  font-size: 0.82rem;
  color: var(--mute);
  touch-action: manipulation;
}

.both-peek-close:hover {
  color: var(--ink);
}

@media (min-width: 800px) {
  .both {
    display: grid;
    grid-template-columns: minmax(0, var(--measure)) minmax(13rem, 16.5rem);
    grid-template-areas: "leaf ink";
    justify-content: center;
    align-items: start;
    max-width: calc(var(--measure) + 17.5rem);
    margin: 0 auto;
  }

  .both-leaf {
    grid-area: leaf;
  }

  .both-ink {
    grid-area: ink;
    align-self: start;
    width: auto;
    height: 28vh;
    max-height: 13.5rem;
    min-height: 5.5rem;
    margin-top: 2.1rem;
    border-bottom: 0;
    border-inline-start: 1px solid var(--rule);
    padding: 0.28rem 0.55rem;
  }
}

.colophon {
  flex-shrink: 0;
  min-height: 1.85rem;
  display: grid;
  place-items: center;
  padding: 0.28rem 0.9rem;
  border-top: 1px solid var(--ink);
  background: var(--page);
  font-family: var(--sefer);
  font-size: 0.82rem;
  color: var(--ink);
}

.colophon a {
  text-decoration: none;
}

.colophon a:hover {
  color: var(--mark);
  text-decoration: none;
}

.quiet {
  margin: 5rem auto;
  max-width: var(--measure);
  text-align: center;
  font-size: 0.95rem;
  color: var(--mute);
}

.noscript {
  margin: 4rem auto;
  text-align: center;
  color: var(--mute);
}

.farbrengen-line {
  display: block;
  width: 100%;
  min-height: 1.7rem;
  padding: 0.22rem 0.9rem 0.32rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--ink);
  background: var(--page);
  font-family: var(--sefer);
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--ink);
  text-align: center;
  direction: rtl;
}

.farbrengen-line:hover {
  color: var(--mark);
}

.farbrengen-line:empty {
  color: transparent;
}

/* ------------------------------------------------------------------ */
/* Retype leaf                                                          */
/* ------------------------------------------------------------------ */

.leaf {
  position: relative;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 2.1rem 3.4rem 3.6rem;
  font-family: var(--type);
  font-size: 21px;
  line-height: 1.7;
  direction: rtl;
}

.leaf-stamp {
  display: block;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink);
  margin: 0 0 1.55rem;
}

.leaf-print {
  display: none;
}

.leaf-draft {
  position: absolute;
  top: 2.15rem;
  left: 1.15rem;
  font-family: var(--ui);
  font-size: 0.72rem;
  color: var(--mute);
  direction: ltr;
}

.leaf-body p {
  margin: 0 0 0.95em;
  text-align: justify;
  text-align-last: start;
  hyphens: none;
  -webkit-hyphens: none;
}

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

.leaf-body p:has(> strong:only-child),
.leaf-body p.heading,
.leaf-body p.dateline,
.leaf-body p.kicker,
.leaf-body p.stamp-line {
  text-align: center;
  text-align-last: center;
}

.leaf-body p.heading {
  font-size: 1.14em;
  margin: 0.25em 0 1.2em;
}

.leaf-body p.dateline {
  margin: 0 0 1.4em;
}

.leaf-body p.kicker {
  color: var(--mute);
  margin-bottom: 1.15em;
}

.leaf-body p.catchword {
  text-align: center;
  text-align-last: center;
  color: var(--mute);
  font-size: 0.82em;
  margin-top: 2em;
  margin-bottom: 0;
}

.leaf-body p.catchword:first-child {
  margin-top: 0;
  margin-bottom: 1.3em;
}

.leaf-body p.sidenote {
  font-size: 0.84em;
  line-height: 1.6;
  margin-top: 1.5em;
}

.leaf-body p.stamp-line {
  font-size: 0.85rem;
  color: var(--ink);
  margin-top: 1.2em;
}

.fix {
  border-bottom: 1px dotted currentColor;
  cursor: help;
}

.ornament {
  display: block;
  text-align: center;
  color: var(--mute);
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  margin: 1.4rem 0;
}

.footnotes {
  margin-top: 2rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--rule);
  font-size: 0.84em;
  line-height: 1.6;
}

.footnotes p {
  margin-bottom: 0.65em;
}

.entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.1rem;
  text-align: start;
  text-align-last: start;
  margin-bottom: 0.22em;
  line-height: 1.5;
}

.entry-page {
  flex: 0 0 auto;
}

.leaf--mafteiach,
.leaf--mafteiach-inyanim {
  font-size: 19px;
  line-height: 1.6;
}

.leaf--mafteiach-inyanim .leaf-body > p:not(.entry) {
  text-align: center;
  text-align-last: center;
  margin: 1.3em 0 0.55em;
}

.titlepage {
  text-align: center;
  padding: 2.6rem 0 3.2rem;
}

.titlepage .display {
  font-size: 2.45rem;
  margin: 0 0 1.4rem;
  text-align: center;
  text-align-last: center;
}

.titlepage p {
  text-align: center;
  text-align-last: center;
  margin: 0 0 0.28em;
  line-height: 1.55;
}

.titlepage .stamp-line {
  margin-top: 1.35rem;
  font-size: 0.9rem;
  color: var(--ink);
}

.titlepage .sp {
  height: 1.05rem;
}

.titlepage .ornament {
  margin: 1.2rem 0;
}

/* ------------------------------------------------------------------ */
/* Note page                                                            */
/* ------------------------------------------------------------------ */

body.note {
  min-height: 100vh;
}

.letter {
  max-width: 32rem;
  margin: 0 auto;
  padding: 3.25rem 1.5rem 4rem;
}

.letter h1 {
  margin: 0 0 1.25rem;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.2;
}

.letter p {
  margin: 0 0 1em;
  font-size: 1.02rem;
  line-height: 1.55;
}

.letter .where {
  color: var(--mute);
}

.address {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.05rem;
  user-select: all;
}

.letter .write {
  margin-top: 0.4rem;
}

.letter nav.return {
  margin-top: 2.4rem;
  font-size: 0.92rem;
  color: var(--mute);
}

.letter nav.return a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.letter nav.return a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ------------------------------------------------------------------ */
/* Work ledger                                                          */
/* ------------------------------------------------------------------ */

body.work {
  min-height: 100vh;
}

.ledger {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 4rem;
}

.ledger h1 {
  margin: 0 0 0.55rem;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.2;
}

.ledger-counts {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  color: var(--ink);
}

.ledger-legend {
  margin: 0 0 0.28rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.ledger-legend .pg {
  margin: 0;
}

.ledger-models {
  margin: 0 0 1.7rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.ledger-kicker {
  margin: 1.35rem 0 0.45rem;
  font-family: var(--type);
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--mute);
}

.ledger-group {
  margin: 0 0 1.15rem;
}

.ledger-head {
  margin: 0 0 0.22rem;
  font-family: var(--sefer);
  font-weight: 400;
  font-size: 1.08rem;
  line-height: 1.35;
}

.ledger-head.is-front {
  color: var(--mute);
  font-size: 0.98rem;
}

.ledger-pages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem 0.62rem;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.pg {
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
}

a.pg:hover,
.ledger-pages .pg:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.pg.grade-none {
  color: var(--grade-none);
}

.pg.grade-bad {
  color: var(--grade-bad);
}

.pg.grade-rough {
  color: var(--grade-rough);
}

.pg.grade-ok {
  color: var(--grade-ok);
}

.pg.grade-good {
  color: var(--grade-good);
}

.pg.grade-verified {
  color: var(--grade-verified);
}

.ledger-notes {
  margin: 0.28rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mute);
}

.ledger-notes li {
  margin: 0 0 0.18rem;
}

.ledger-note-pages {
  color: var(--ink);
}

.sheet-model {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.sheet-grades {
  margin-bottom: 1.05rem;
}

.sheet-grades .sheet-choice.grade-none {
  color: var(--grade-none);
}

.sheet-grades .sheet-choice.grade-bad {
  color: var(--grade-bad);
}

.sheet-grades .sheet-choice.grade-rough {
  color: var(--grade-rough);
}

.sheet-grades .sheet-choice.grade-ok {
  color: var(--grade-ok);
}

.sheet-grades .sheet-choice.grade-good {
  color: var(--grade-good);
}

.sheet-grades .sheet-choice.grade-verified {
  color: var(--grade-verified);
}

.sheet-grades .sheet-choice.is-active {
  border-bottom-color: currentColor;
}

#rate-note {
  min-height: 4.5rem;
}

.sheet-check {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0.95rem 0 0.2rem;
  font-size: 0.95rem;
  cursor: pointer;
}

.sheet-check input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--mark);
}

.sheet-hint {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: var(--mute);
}

/* ------------------------------------------------------------------ */
/* Reader work cue (?work=1 only)                                       */
/* ------------------------------------------------------------------ */

.work-cue {
  margin: 0;
  width: 100%;
  padding: 0.14rem 0.9rem 0.28rem;
  border-bottom: 1px solid var(--ink);
  background: var(--page);
  font-family: var(--ui);
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--mute);
  text-align: center;
}

.farbrengen-line.has-work-cue {
  border-bottom-color: var(--rule);
}

/* ------------------------------------------------------------------ */
/* Hold-to-note on retype paragraphs                                    */
/* ------------------------------------------------------------------ */

.leaf p[data-p] {
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

.leaf p.is-holding {
  background: #F3E4E6;
}

/* ------------------------------------------------------------------ */
/* Contents overlay                                                     */
/* ------------------------------------------------------------------ */

.contents {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  background: var(--page);
}

.contents[hidden] {
  display: none !important;
}

.contents-panel {
  width: min(34rem, 100%);
  height: 100%;
  overflow: auto;
  background: var(--page);
  border-inline: 1px solid var(--rule);
  padding: 1rem 1.15rem 2.4rem;
  direction: rtl;
}

.contents-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.7rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--ink);
}

.contents-head h2 {
  margin: 0;
  font-family: var(--sefer);
  font-weight: 400;
  font-size: 1.35rem;
}

.contents-close {
  font-family: var(--ui);
  font-size: 0.82rem;
  color: var(--mute);
  direction: ltr;
}

.contents-close:hover {
  color: var(--ink);
}

.toc-kicker {
  margin: 1.05rem 0 0.2rem;
  font-family: var(--type);
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--mute);
}

.toc-kicker:first-child {
  margin-top: 0.15rem;
}

.toc-entry {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.85rem;
  width: 100%;
  padding: 0.18rem 0 0.16rem;
  border-bottom: 1px dotted var(--rule);
  font-family: var(--type);
  font-size: 1rem;
  line-height: 1.35;
  text-align: start;
}

.toc-entry:hover {
  border-bottom-style: solid;
  border-bottom-color: var(--ink);
}

.toc-entry.is-current {
  color: var(--mark);
  border-bottom-style: solid;
  border-bottom-color: var(--mark);
}

.toc-entry.is-front {
  color: var(--mute);
  font-size: 0.92rem;
}

.toc-entry.is-front.is-current {
  color: var(--mark);
}

.toc-name {
  min-width: 0;
}

.toc-pages {
  flex: 0 0 auto;
  color: var(--mute);
  font-size: 0.9em;
}

/* ------------------------------------------------------------------ */
/* Note sheet and download sheet                                        */
/* ------------------------------------------------------------------ */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--page);
}

.sheet[hidden] {
  display: none !important;
}

.sheet-panel {
  width: min(32rem, 100%);
  max-height: calc(100vh - 3rem);
  overflow: auto;
  background: var(--page);
  border: 1px solid var(--rule);
  padding: 1.65rem 1.6rem 1.45rem;
}

.sheet-kicker {
  margin: 0 0 0.45rem;
  font-family: var(--type);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--mute);
  direction: rtl;
  text-align: start;
}

.sheet-heading {
  margin: 0 0 0.75rem;
  font-family: var(--ui);
  font-weight: 600;
  font-size: 1.12rem;
}

.sheet-quote {
  margin: 0 0 0.85rem;
  font-family: var(--type);
  font-size: 1.02rem;
  line-height: 1.6;
  direction: rtl;
  text-align: justify;
  text-align-last: start;
  max-height: 7.5em;
  overflow: auto;
}

.sheet-ink {
  margin: 0 0 0.95rem;
  border: 1px solid var(--rule);
  background: var(--page);
}

.sheet-ink canvas,
.sheet-ink img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28vh;
  object-fit: contain;
  object-position: top center;
}

.sheet-label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.82rem;
  color: var(--mute);
}

.sheet-panel textarea {
  display: block;
  width: 100%;
  min-height: 7.25rem;
  margin: 0;
  padding: 0.35rem 0 0.5rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--ui);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
}

.sheet-panel textarea:focus {
  outline: none;
  border-bottom-color: var(--mark);
}

.sheet-actions {
  display: flex;
  align-items: baseline;
  gap: 1.35rem;
  margin-top: 1.05rem;
}

.sheet-actions button {
  font-size: 0.92rem;
  color: var(--mute);
  padding: 0 0 0.1rem;
  border-bottom: 1px solid transparent;
}

.sheet-actions button:hover {
  color: var(--ink);
}

#sheet-send,
#download-go,
#rate-save {
  color: var(--ink);
  border-bottom-color: var(--mark);
}

#download-go:disabled {
  color: var(--rule);
  cursor: default;
  border-bottom-color: transparent;
}

.sheet-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 1.05rem;
  margin: 0 0 1.2rem;
}

.sheet-choice {
  padding: 0 0 0.12rem;
  border-bottom: 1px solid transparent;
  font-size: 0.95rem;
  color: var(--mute);
}

.sheet-choice.is-active {
  color: var(--ink);
  border-bottom-color: var(--mark);
}

.sheet-mode {
  margin: 0 0 0.95rem;
}

.sheet-mode.is-off {
  opacity: 0.48;
}

.sheet-mode-btn {
  display: block;
  margin-bottom: 0.32rem;
  padding: 0 0 0.1rem;
  border-bottom: 1px solid transparent;
  font-size: 0.9rem;
  color: var(--mute);
  text-align: start;
}

.sheet-mode.is-on .sheet-mode-btn {
  color: var(--ink);
  border-bottom-color: var(--mark);
}

.sheet-select {
  display: block;
  width: 100%;
  margin: 0.1rem 0 0;
  padding: 0.28rem 0 0.42rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--type);
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink);
  direction: rtl;
  text-align: start;
}

.sheet-select:focus {
  outline: none;
  border-bottom-color: var(--mark);
}

.sheet-select:disabled {
  color: var(--mute);
}

.sheet-range {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1.1rem;
  margin-top: 0.2rem;
  font-size: 0.9rem;
  color: var(--mute);
}

.sheet-range label {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.sheet-range input {
  width: 2.7rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0.1rem 0 0.12rem;
  text-align: center;
  font-family: var(--ui);
  font-size: 0.98rem;
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.sheet-range input::-webkit-outer-spin-button,
.sheet-range input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sheet-range input:focus {
  outline: none;
  border-bottom-color: var(--mark);
}

.sheet-range input:disabled {
  color: var(--mute);
  border-bottom-color: transparent;
}

.sheet-status,
.sheet-error {
  margin: 0.15rem 0 0;
  font-size: 0.88rem;
  color: var(--mute);
}

.sheet-error {
  color: var(--mark);
}

/* ------------------------------------------------------------------ */
/* Small screens                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 720px) {
  .bar {
    padding: 0.4rem 0.75rem 0.42rem;
    gap: 0.35rem 0.7rem;
  }

  .bar-brand {
    gap: 0.7rem;
  }

  .bar-page {
    margin-inline-start: 0;
    flex: 1 1 100%;
  }

  .bar-note-ctl {
    margin-inline-start: 0.55rem;
  }

  .leaf {
    padding: 1.6rem 1.15rem 2.8rem;
    font-size: 20px;
  }

  .leaf-print,
  .leaf-draft {
    position: static;
    display: block;
    text-align: center;
    margin-bottom: 0.35rem;
  }

  .cover {
    padding: 0.85rem 0.75rem 1.2rem;
    justify-content: flex-start;
  }

  .cover-scan {
    max-width: min(22.5rem, 100%);
  }

  .cover-scan img {
    max-height: min(64vh, 34rem);
  }

  .contents-panel {
    width: 100%;
    border-inline: 0;
  }

  .sheet {
    padding: 0.55rem;
    align-items: flex-start;
  }

  .sheet-panel {
    max-height: calc(100vh - 1.1rem);
  }

  .letter {
    padding: 2.4rem 1.15rem 3.5rem;
  }

  .ledger {
    padding: 1.8rem 1.15rem 3.5rem;
  }

  .work-cue {
    padding-inline: 0.75rem;
  }
}
