/* Anchor. The screen is a reading instrument: a dark field, one word lit in
   the middle of a sighting reticle, and the red pivot letter as the only
   colour. Everything else is quiet and steps back further while reading. */

@font-face {
  font-family: 'Literata';
  src: url('../fonts/literata-latin.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Literata';
  src: url('../fonts/literata-latin-ext.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-latin.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-latin-ext.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root,
:root[data-theme='night'] {
  color-scheme: dark;
  --field: #03051a;
  --surface: #0a0f2b;
  --surface-2: #121a3d;
  --guide: #1d2748;
  --line: #1a2244;
  --word: #f4f3ef;
  --pivot: #ea3a55;
  --text: #c8cde0;
  --text-2: #8d94b2;
  --text-3: #545c80;
  --focus: #8fb0ff;
  --scrim: rgba(1, 2, 12, 0.66);
}
:root[data-theme='black'] {
  color-scheme: dark;
  --field: #000000;
  --surface: #0d0d10;
  --surface-2: #19191e;
  --guide: #24242b;
  --line: #1e1e24;
  --word: #f2f2f2;
  --pivot: #ff3e57;
  --text: #c9c9cf;
  --text-2: #8e8e98;
  --text-3: #55555e;
  --focus: #9fb6ff;
  --scrim: rgba(0, 0, 0, 0.7);
}
:root[data-theme='day'] {
  color-scheme: light;
  --field: #eef1f6;
  --surface: #ffffff;
  --surface-2: #e3e8f1;
  --guide: #c6cede;
  --line: #d6dce8;
  --word: #0c1131;
  --pivot: #d21d3d;
  --text: #2a3152;
  --text-2: #5a6282;
  --text-3: #9aa1b8;
  --focus: #2f5bd8;
  --scrim: rgba(20, 26, 50, 0.4);
}
/* Warm, low-glare paper for long sessions in daylight. */
:root[data-theme='paper'] {
  color-scheme: light;
  --field: #f3ead6;
  --surface: #faf5e9;
  --surface-2: #ebe0c6;
  --guide: #cdbd98;
  --line: #e0d3b3;
  --word: #2a2017;
  --pivot: #bf2f2a;
  --text: #3b3024;
  --text-2: #6b5a45;
  --text-3: #a08d70;
  --focus: #2f5bd8;
  --scrim: rgba(43, 32, 14, 0.35);
}

/* Other focal colors, for readers who can't pick red out easily. Amber and
   blue stay distinct for the common red-green colour deficiencies. */
:root[data-focus='amber'] { --pivot: #f4a62a; }
:root[data-focus='blue'] { --pivot: #4aa8ff; }
:root[data-theme='day'][data-focus='amber'],
:root[data-theme='paper'][data-focus='amber'] { --pivot: #a65f00; }
:root[data-theme='day'][data-focus='blue'],
:root[data-theme='paper'][data-focus='blue'] { --pivot: #1d5fd6; }

:root {
  --font-word: 'Literata', Georgia, 'Times New Roman', serif;
  --font-ui: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
  --word-scale: 1;
  --word-size: calc(clamp(2.25rem, 1.15rem + 4.4vw, 4.4rem) * var(--word-scale));
  /* Where the pivot sits across the reticle: left of centre, so long
     endings have room. */
  --anchor: 38%;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
:root[data-font='sans'] {
  --font-word: 'Atkinson Hyperlegible Next', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  height: 100%;
  background: var(--field);
  color: var(--text);
  font: 400 1rem/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.375rem; height: 1.375rem; flex: none; }
.icon-small { width: 1rem; height: 1rem; }
.icon-large { width: 2rem; height: 2rem; }

/* ---------------------------------------------------------------- layout */

.app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.reader {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(13rem, 38vh) auto minmax(0, 1fr);
}
body.no-context .reader { grid-template-rows: minmax(13rem, 1fr) auto 0; }
body.no-context .reader .stage { padding-bottom: 6vh; }

/* ------------------------------------------------------------------- bar */

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  transition: opacity 0.5s var(--ease);
}
.wordmark {
  font: 450 1.3rem/1 var(--font-word);
  letter-spacing: 0.01em;
  color: var(--word);
  flex: none;
}
.wordmark b { font-weight: inherit; color: var(--pivot); }
.doc-button {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.6rem;
  margin-left: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--text-2);
}
.doc-button:hover { background: var(--surface); color: var(--text); }
.doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-2);
  transition: background-color 0.15s, color 0.15s;
}
.icon-button:hover { background: var(--surface-2); color: var(--word); }
.icon-button:active { transform: scale(0.94); }
.tool {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.9rem 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--text);
}
.tool:hover { border-color: var(--text-3); color: var(--word); }
.tool[aria-pressed='false'] { color: var(--text-3); border-style: dashed; }
.tool-wide { width: 100%; justify-content: center; margin-top: 1rem; }

/* ----------------------------------------------------------------- stage */

.stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1rem 0 0;
  /* The word measures itself against the room it has (see .reticle). */
  container-type: size;
  cursor: pointer;
  user-select: none;
}
.reticle {
  /* The chosen size, unless the stage is too short for it: then the largest
     that leaves the note below the reticle clear. */
  --word-fit: min(var(--word-size), (100cqh - 3.25rem) / 2.5);
  position: relative;
  width: min(100% - 2rem, 50rem);
  height: calc(var(--word-fit) * 2.5);
}
.guide {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--guide) 12%, var(--guide) 88%, transparent);
}
.guide-top { top: 0; }
.guide-bottom { bottom: 0; }
/* The notch on each rule marks the column the pivot letter lands in. */
.guide::after {
  content: '';
  position: absolute;
  left: var(--anchor);
  width: 1px;
  height: calc(var(--word-fit) * 0.42);
  background: var(--guide);
}
.guide-top::after { top: 0; }
.guide-bottom::after { bottom: 0; }

.word {
  position: absolute;
  top: 50%;
  left: 0;
  width: calc(var(--anchor) * 2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  transform: translateY(-50%);
  font: 400 var(--word-fit)/1.2 var(--font-word);
  font-feature-settings: 'kern', 'liga';
  color: var(--word);
  white-space: pre;
}
.word .before { justify-self: end; }
.word .after { justify-self: start; }
.word .pivot { color: var(--pivot); }

.stage-note {
  position: absolute;
  bottom: 0.25rem;
  left: 1rem;
  right: 1rem;
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-3);
  transition: opacity 0.4s var(--ease);
}
.stage-flash {
  position: absolute;
  top: 1rem;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}
.stage-flash.is-shown { opacity: 1; transition-duration: 0.1s; }

/* ------------------------------------------------------------------ deck */

.deck {
  width: min(100% - 2rem, 50rem);
  margin: 0 auto;
  padding: 1.25rem 0 0.75rem;
  transition: opacity 0.5s var(--ease);
}
.progress { display: grid; gap: 0.4rem; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.scrub {
  --pct: 0%;
  width: 100%;
  height: 1.25rem;
  margin: 0;
  background: none;
  appearance: none;
  cursor: pointer;
}
.scrub::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--text-2) var(--pct), var(--line) var(--pct));
}
.scrub::-moz-range-track { height: 3px; border-radius: 3px; background: var(--line); }
.scrub::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--text-2); }
.scrub::-webkit-slider-thumb {
  appearance: none;
  width: 0.875rem;
  height: 0.875rem;
  margin-top: calc(-0.4375rem + 1.5px);
  border: 0;
  border-radius: 50%;
  background: var(--word);
}
.scrub::-moz-range-thumb { width: 0.875rem; height: 0.875rem; border: 0; border-radius: 50%; background: var(--word); }

.transport {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}
.steps { display: flex; align-items: center; gap: 0.25rem; }
.play {
  width: 3.75rem;
  height: 3.75rem;
  margin: 0 0.5rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--word);
  color: var(--field);
  transition: transform 0.15s var(--ease);
}
.play .icon { width: 1.75rem; height: 1.75rem; }
.play:hover { transform: scale(1.05); }
.play:active { transform: scale(0.95); }
.speed { display: flex; align-items: center; justify-self: start; }
.speed-value {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  color: var(--text-3);
  font-size: 0.8125rem;
}
.speed-value input {
  width: 3.4ch;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: none;
  color: var(--word);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  appearance: textfield;
  -moz-appearance: textfield;
}
.speed-value input:hover, .speed-value input:focus { border-bottom-color: var(--text-3); outline: none; }
.speed-value input::-webkit-inner-spin-button, .speed-value input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.deck-end { justify-self: end; }

/* --------------------------------------------------------------- context */

.context {
  min-height: 0;
  position: relative;
  transition: opacity 0.5s var(--ease);
}
body.no-context .context { display: none; }
.context-scroll {
  position: relative;
  height: 100%;
  overflow-y: auto;
  padding: 0 1rem;
  mask-image: linear-gradient(transparent, #000 2.5rem, #000 calc(100% - 3rem), transparent);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.context-text {
  max-width: 38rem;
  margin: 0 auto;
  padding: 2rem 0 40vh;
  font: 400 1.0625rem/1.8 var(--font-word);
  color: var(--text-2);
  overflow-wrap: break-word;
}
.context-text p { margin: 0 0 1em; }
.context-text span { cursor: pointer; border-radius: 2px; }
.context-text span:hover { color: var(--word); }
.context-text .read { color: var(--text-3); }
.context-text .now {
  color: var(--word);
  background: linear-gradient(var(--pivot), var(--pivot)) no-repeat 0 100% / 100% 2px;
}

/* While reading, everything but the word steps back. Moving the pointer or
   focusing a control brings it forward again. */
body.is-playing .bar,
body.is-playing .deck { opacity: 0.16; }
body.is-playing .context { opacity: 0.5; }
body.is-playing .stage-note { opacity: 0; }
body.is-playing.is-awake .bar,
body.is-playing.is-awake .deck,
body.is-playing .bar:hover,
body.is-playing .deck:hover,
body.is-playing .bar:focus-within,
body.is-playing .deck:focus-within,
body.is-playing .context:hover { opacity: 1; }
body.is-playing:not(.is-awake) .stage { cursor: none; }

/* Zen: while reading, nothing but the word and its reticle. Pausing brings
   everything back. */
body.is-zen.is-playing .bar,
body.is-zen.is-playing .deck,
body.is-zen.is-playing .context { opacity: 0; pointer-events: none; }
body.is-zen.is-playing .stage { cursor: none; }

/* --------------------------------------------------------------- dialogs */

.sheet {
  width: min(40rem, 100% - 1.5rem);
  max-height: min(48rem, 100% - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
}
.sheet[open] { animation: sheet-in 0.22s var(--ease); }
.sheet::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(0.75rem) scale(0.98); } }
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0.75rem 0.25rem 1.5rem;
}
.sheet-head h2 { margin: 0; font: 500 1.375rem/1.3 var(--font-word); color: var(--word); }
.sheet-body { padding: 0.75rem 1.5rem 1.5rem; }

.file-pick {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.2rem;
  padding: 1.75rem 1rem 1.5rem;
  border: 1.5px dashed var(--guide);
  border-radius: 0.875rem;
  text-align: center;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.file-pick:hover, .file-pick:focus-within { border-color: var(--text-3); background: var(--surface-2); }
.file-pick strong { color: var(--word); font-size: 1.0625rem; font-weight: 600; margin-top: 0.4rem; }
.file-pick small { margin-top: 0.6rem; color: var(--text-3); max-width: 30rem; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-pick .icon { color: var(--text-2); }

.paste { display: grid; gap: 0.5rem; margin-top: 1.5rem; }
.paste > label { color: var(--text-2); font-size: 0.9375rem; }
.paste textarea, .paste input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  background: var(--field);
  padding: 0.7rem 0.85rem;
}
.paste textarea { resize: vertical; min-height: 8rem; line-height: 1.55; }
.paste textarea:focus, .paste input:focus { border-color: var(--text-3); outline: none; }
.paste-row { display: flex; gap: 0.5rem; }
.primary {
  flex: none;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 0;
  border-radius: 0.625rem;
  background: var(--word);
  color: var(--field);
  font-weight: 600;
}
.primary:hover { background: var(--text); }
.open-status { margin: 1rem 0 0; min-height: 1.5em; color: var(--text-2); font-size: 0.9375rem; }
.open-status.is-error { color: var(--pivot); }
.open-status:empty { display: none; }

.library { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.library li { display: flex; align-items: center; gap: 0.25rem; border-radius: 0.75rem; }
.library li:hover { background: var(--surface-2); }
.library li.is-current .library-title::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--pivot);
  vertical-align: 0.15em;
}
.library-open {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem 0.75rem;
  border: 0;
  background: none;
  text-align: left;
}
.library-title { color: var(--word); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { font-size: 0.8125rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.library-bar { height: 2px; border-radius: 2px; background: var(--line); margin-top: 0.35rem; overflow: hidden; }
.library-bar i { display: block; height: 100%; background: var(--text-2); }
.library-empty { color: var(--text-2); margin: 0.5rem 0 0; }

.settings { display: grid; gap: 1.4rem; }
.settings-group {
  margin: 0.6rem 0 -0.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font: 600 0.75rem/1.2 var(--font-ui);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.settings-group:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.field { display: grid; gap: 0.5rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend { padding: 0; color: var(--word); font-weight: 600; display: flex; justify-content: space-between; width: 100%; }
.field output { color: var(--text-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.field legend { margin-bottom: 0.5rem; }
.hint { margin: 0; color: var(--text-3); font-size: 0.875rem; }
.settings input[type='range'] { width: 100%; accent-color: var(--word); }
.segmented { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
}
.segmented input:checked + span { border-color: var(--word); color: var(--word); background: var(--surface-2); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.segmented label:hover span { color: var(--word); }
.font-serif { font-family: 'Literata', serif; }
.font-sans { font-family: 'Atkinson Hyperlegible Next', sans-serif; }
.swatch { width: 0.9rem; height: 0.9rem; border-radius: 50%; border: 1px solid var(--text-3); }
.swatch-night { background: #03051a; }
.swatch-black { background: #000; }
.swatch-day { background: #eef1f6; }
.swatch-paper { background: #f3ead6; }
.swatch-red { background: #ea3a55; border-color: transparent; }
.swatch-amber { background: #f4a62a; border-color: transparent; }
.swatch-blue { background: #4aa8ff; border-color: transparent; }
.swatches b { font-weight: inherit; }
.check { display: flex; gap: 0.6rem; align-items: center; cursor: pointer; }
.check input { flex: none; width: 1.1rem; height: 1.1rem; accent-color: var(--pivot); }
.check:has(.hint) { align-items: flex-start; }
.check:has(.hint) input { margin-top: 0.2rem; }
.check .hint { display: block; margin-top: 0.15rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.stats > div {
  display: grid;
  align-content: start;
  gap: 0.2rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
}
.stats dt { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.stats dd { margin: 0; display: grid; }
.stats b {
  font: 500 1.6rem/1.15 var(--font-word);
  color: var(--word);
  font-variant-numeric: tabular-nums;
}
.stats small { font-size: 0.8125rem; color: var(--text-2); }
.shortcuts summary { cursor: pointer; color: var(--text-2); }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; margin: 0.75rem 0 0; font-size: 0.9375rem; }
.shortcuts dt { color: var(--text-2); white-space: nowrap; }
.shortcuts dd { margin: 0; }
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 0.35em;
  font: inherit;
  font-size: 0.8125rem;
  text-align: center;
  color: var(--text);
}

/* ------------------------------------------------------------ overlays */

.drop-zone {
  position: fixed;
  inset: 0.75rem;
  z-index: 20;
  display: grid;
  place-items: center;
  border: 2px dashed var(--text-2);
  border-radius: 1.5rem;
  background: var(--scrim);
  pointer-events: none;
}
.drop-zone p { font: 500 1.5rem var(--font-word); color: var(--word); }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1.25rem + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 0.75rem 0.75rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.875rem;
  background: var(--surface-2);
  color: var(--word);
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.35);
  transform: translateX(-50%);
  animation: toast-in 0.2s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 0.5rem); } }
.toast-action { border: 0; background: none; color: var(--pivot); font-weight: 600; padding: 0.25rem 0.5rem; border-radius: 0.5rem; }
.toast-action:hover { background: var(--surface); }

/* --------------------------------------------------------------- narrow */

@media (max-width: 40rem) {
  .bar { padding: 0.5rem 0.75rem; gap: 0.25rem; }
  .doc-button { margin-left: 0.25rem; }
  .tool span { display: none; }
  .tool { padding: 0; width: 2.75rem; justify-content: center; }
  .reader { grid-template-rows: minmax(11rem, 32vh) auto minmax(0, 1fr); }
  :root { --anchor: 34%; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stats > div { grid-template-columns: 6rem minmax(0, 1fr); align-items: baseline; }
  .transport {
    grid-template-columns: 1fr auto;
    grid-template-areas: 'steps steps' 'speed end';
    row-gap: 0.25rem;
  }
  .steps { grid-area: steps; justify-content: center; }
  .speed { grid-area: speed; }
  .deck-end { grid-area: end; }
  .paste-row { flex-direction: column; }
  .sheet-body { padding: 0.5rem 1rem 1.25rem; }
  .sheet-head { padding-left: 1rem; }
}
@media (max-height: 34rem) and (min-width: 40rem) {
  .reader { grid-template-rows: minmax(9rem, 1fr) auto minmax(0, 0.8fr); }
}

/* With the focal letter in the middle of each word, the word is centred. */
:root[data-pivot='middle'] { --anchor: 50%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
