/*
 * The site on a phone (docs/site-overlay.md, js/site-phone.js). Everything here acts at the fork's phone breakpoint
 * (`ve-mobile-sm`, 768px) and changes nothing wider. Sizes are in px: the fork's root font size is 10px. The fork
 * swaps css/<name>.css for a mirrored .rtl.css in right-to-left languages, which this folder is outside of; the file is
 * written with logical properties. Selectors name upstream's classes; the phone e2e suite fails if upstream renames
 * the ones a reader depends on.
 */

/* biome-ignore-all lint/complexity/noImportantStyles: upstream sizes the lists, rows and columns with inline styles and its own !important utility classes (`.ve-col-*`, `.ve-flex`), which only an important rule overrides */
/* biome-ignore-all lint/style/noDescendingSpecificity: the sections style unrelated parts of upstream's pages (list rows, the filter window, the CR calculator), so no selector here is meant to override a later, weaker one */

.site-sr-only {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* What the phone layout adds exists only on a phone. */
.site-phone-bar,
.site-phone-quick,
.site-filter-summary,
.site-phone-contents__head,
.site-row-english,
.site-my-lists,
.site-list-tools__toggle,
.site-back-to-top,
.site-filter-window__footer,
.site-filter-section__chevron {
  display: none;
}

.site-phone-listhead,
.site-filter-window__tucked {
  display: contents;
}

/*
 * The fork's day-mode stat block lays a texture over its colour (`img/bestiary/stat-block-top-texture.webp`, fork
 * scss/bestiary.scss), but the site ships no `img/` folder (images come from GitHub, `DEPLOYED_IMG_ROOT`), so the file
 * only ever 404s; the list layout makes the browser ask for it. Unlayered, this outranks the fork's `vetools` layer,
 * and night mode's important rule still sets its own background.
 */
#pagecontent {
  background-image: none;
}

/* A wide table scrolls in its own box at any width; at a desktop width few are wider than their column. */
.site-table-scroll {
  max-inline-size: 100%;
  overflow-x: auto;
}

/*
 * The fork lays a page's text out `unicode-bidi: plaintext`, which reads the lone "(" and ")" around a recipe's scale
 * selector (upstream's `Renderer.recipe` wrapper) as left to right, so right to left they face away from the selector.
 */
div:has(> select.ve-popwindow__hidden) {
  unicode-bidi: normal;
}

/* An exported image has nothing to scroll, and the export would draw the box's scrollbars over the table. */
.ve-lst__is-exporting-image .site-table-scroll {
  overflow-x: visible;
}

/* The export fixes every cell at its measured width, which breaks a score's digits apart in this tight table. */
.ve-lst__is-exporting-image table:has(.ve-stats-tbl-ability-scores__lbl-abv) td {
  white-space: nowrap;
}

@media (width > 768px) {
  /* The word (js/site-phone-list.js `nameConcentrationColumn`) fits the narrow column only without the button's padding. */
  #sublistsort [data-sort="concentration"],
  [id^="filtertools"] [data-sort="concentration"] {
    padding-inline: 0;
  }
}

@media (width <= 768px) {
  :root {
    --phone-ink: #1d1b19;
    --phone-muted: #6b645c;
    --phone-surface: #fff;
    --phone-raised: #f4f1ec;
    --phone-line: rgb(40 20 10 / 12%);
    --phone-accent: #8a2c1b;
    --phone-on-accent: #fff;
    --phone-focus: #2a6fdb;
    --phone-bar-shadow: 0 1px 0 var(--phone-line), 0 6px 16px -10px rgb(0 0 0 / 35%);
    --phone-tuck: transform 0.2s ease;
    --site-list-tools-top: 10px;
  }

  :root.ve-night-mode {
    --phone-ink: #ece7e1;
    --phone-muted: #a39b91;
    --phone-surface: #222;
    --phone-raised: #2c2c2c;
    --phone-line: rgb(255 255 255 / 10%);
    --phone-accent: #e0806b;
    --phone-on-accent: #1d1b19;
    --phone-focus: #8bb4ff;
  }

  @media (prefers-reduced-motion: reduce) {
    :root {
      --phone-tuck: none;
    }
  }

  /* Upstream's page wrapper scrolls sideways (`overflow: auto`) without ever being taller than its content, so the bars
     that should stick to the top of the screen stuck to it instead and scrolled away; clipping is not scrolling. */
  .viewport-wrapper {
    overflow: clip !important;
  }

  /* Room under the last line for the corner buttons (dice, language tools, to top), which stay fixed over the page. */
  body {
    padding-block-end: 64px;
  }

  button:focus-visible,
  a:focus-visible {
    outline: 2px solid var(--phone-focus);
    outline-offset: 2px;
  }

  /* A bar that stepped aside while the reader scrolls down (`tuckOnScroll`). */
  .site-phone-tucked {
    transform: translateY(calc(-100% - 12px));
  }

  /* -------------------------------- Bars -------------------------------- */

  .site-phone-bar {
    position: sticky;
    z-index: 20;
    inset-block-start: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-block-end: 8px;
    margin-inline: -4px;
    padding: 6px 4px;
    background: var(--phone-surface);
    box-shadow: var(--phone-bar-shadow);
    transition: var(--phone-tuck);
  }

  .site-phone-bar button {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-block-size: 44px;
    min-inline-size: 44px;
    padding-inline: 12px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font: inherit;
    font-size: 15px;
  }

  .site-phone-bar button:disabled {
    opacity: 0.3;
  }

  /* The back button names its page, which can be long ("گزینه‌ها و ویژگی‌های دیگر"). */
  .site-phone-bar__back {
    flex-shrink: 1 !important;
    min-inline-size: 0;
  }

  .site-phone-bar__back .site-phone-button__text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The share button's sheet (js/site-phone-share.js), at the bottom of the screen where a thumb is. */
  .site-share {
    inset-block: auto 0;
    inline-size: 100%;
    max-inline-size: 100%;
    margin: 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border: 0;
    border-start-start-radius: 16px;
    border-start-end-radius: 16px;
    background: var(--phone-surface);
    color: var(--phone-ink);
  }

  .site-share::backdrop {
    background: rgb(0 0 0 / 50%);
  }

  /* The copy of the entry a shared image is made from, laid out wider than the screen and out of sight. */
  .site-share__layout {
    position: fixed;
    inset-block-start: 0;
    left: -10000px;
  }

  .site-share__body {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .site-share__message {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
  }

  .site-share__choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-block-size: 52px;
    padding-inline: 16px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font: inherit;
    font-size: 16px;
  }

  .site-phone-bar__steps {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-inline-start: auto;
  }

  .site-phone-bar__position {
    min-inline-size: 56px;
    color: var(--phone-ink);
    font-size: 14px;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  /* -------------------------------- List pages: one pane at a time -------------------------------- */

  :root[data-site-phone-view="list"] [data-site-phone-pane="entry"],
  :root[data-site-phone-view="entry"] [data-site-phone-pane="list"] {
    display: none !important;
    /* A pane upstream lays out with `.ve-flex` keeps `display: flex !important` from the fork's `vetools` cascade layer,
       which beats an important rule outside it (the classes page's rows); these take such a pane out of sight anyway. */
    position: absolute !important;
    visibility: hidden !important;
    block-size: 0 !important;
    overflow: hidden !important;
  }

  :root[data-site-phone-view] .site-phone-bar {
    display: flex;
  }

  /* The list grows with the page instead of scrolling in a box of its own inside the scrolling page; so does the entry,
     which lets its bar stick to the top of the screen. */
  #listcontainer,
  #listcontainer .list:not(#lst-contents),
  :root[data-site-phone-view="entry"] [data-site-phone-pane="entry"] {
    /* A flex item is as wide as its content by default; the sideways-scrolling sort row would widen the page. */
    min-inline-size: 0;
    block-size: auto !important;
    max-block-size: none !important;
    min-block-size: 0 !important;
    overflow: visible !important;
  }

  :root[data-site-phone-view] .view-col-group--cancer,
  :root[data-site-phone-view] .view-col-wrapper,
  :root[data-site-phone-view] [data-site-phone-pane="entry"] .view-col {
    max-inline-size: 100%;
    block-size: auto !important;
    min-block-size: 0 !important;
    overflow: visible !important;
  }

  /* -------------------------------- Above the list -------------------------------- */

  /* The search box, the filter summary and the sort headers, together and in reach as the list scrolls. */
  .site-phone-listhead {
    position: sticky;
    z-index: 15;
    inset-block-start: 0;
    display: block;
    margin-inline: -4px;
    padding: 8px 4px 0;
    background: var(--phone-surface);
    box-shadow: var(--phone-bar-shadow);
    transition: var(--phone-tuck);
  }

  /* Where the thumb rests: the start edge is the right of a right-to-left page, and the language button has the left. */
  .site-back-to-top:not([hidden]) {
    position: fixed;
    z-index: 15;
    inset-block-end: calc(16px + env(safe-area-inset-bottom));
    inset-inline-start: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 52px;
    block-size: 52px;
    border: 0;
    border-radius: 50%;
    background: var(--phone-raised);
    color: var(--phone-ink);
    box-shadow: var(--phone-bar-shadow);
    font-size: 18px;
  }

  /* The summary opens the filters and clears them; shuffling and hiding the list are desktop tools. */
  .site-phone-listhead #filter-search-group > button {
    display: none !important;
  }

  .site-phone-listhead #filter-search-group {
    display: flex;
  }

  /* 16px keeps a phone from zooming into the box as it is typed in. */
  .site-phone-listhead #lst__search {
    block-size: 44px;
    padding-inline: 40px 12px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font-size: 16px;
  }

  .site-phone-listhead #lst__search-glass {
    inset-inline-start: 0;
    inline-size: 40px;
    block-size: 44px;
    color: var(--phone-muted);
  }

  /* Upstream's "shown/total" inside the box; the summary says how many are shown. Its `.ve-flex-vh-center` keeps
     `display: flex !important` from the fork's `vetools` cascade layer, which beats an important rule outside it. */
  .site-phone-listhead .ve-lst__wrp-search-visible {
    visibility: hidden;
  }

  :root[data-site-phone-summary] .ve-fltr__mini-view {
    display: none !important;
  }

  /* Sorting: the column names as a table's header row, which scrolls sideways when the names outrun the screen. The
     books and adventures lists have no search group, so no list head (`mountListHead`); their header row gets the
     same treatment where it stands. */
  .site-phone-listhead [id^="filtertools"],
  #listcontainer > [id^="filtertools"] {
    display: flex !important;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-block-start: 1px solid var(--phone-line);
    scrollbar-width: none;
  }

  .site-phone-listhead [id^="filtertools"] > button,
  #listcontainer > [id^="filtertools"] > button {
    flex: none !important;
    /* Upstream's column widths are important inside the fork's layer; these two sizes outrank them. */
    min-inline-size: max-content;
    max-inline-size: max-content;
    min-block-size: 40px;
    outline-offset: -2px;
    padding: 0 12px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--phone-muted) !important;
    font-size: 13px;
    font-weight: 500;
  }

  .site-phone-listhead [id^="filtertools"] > button:has(.ve-lst__caret--active),
  #listcontainer > [id^="filtertools"] > button:has(.ve-lst__caret--active) {
    color: var(--phone-ink) !important;
    font-weight: 700;
    box-shadow: inset 0 -2px 0 var(--phone-accent) !important;
  }

  /* -------------------------------- The filter summary -------------------------------- */

  /* One line: more filters than fit scroll sideways, with the clear button held at the end. */
  .site-filter-summary {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-block: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-filter-summary button {
    min-block-size: 40px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
  }

  .site-filter-summary__open {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    text-align: start;
  }

  .site-filter-summary__icon {
    color: var(--phone-muted);
    font-size: 13px;
  }

  .site-filter-summary__count {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  .site-filter-summary__chip {
    flex: none;
    padding: 4px 12px;
    white-space: nowrap;
    border-color: color-mix(in srgb, var(--phone-accent) 35%, transparent) !important;
    background: color-mix(in srgb, var(--phone-accent) 12%, transparent) !important;
    text-align: start;
  }

  .site-filter-summary__header,
  .site-filter-summary__default,
  .site-filter-summary__more {
    color: var(--phone-muted);
  }

  .site-filter-summary__sign {
    color: var(--phone-accent);
  }

  .site-filter-summary__clear {
    position: sticky;
    inset-inline-end: 0;
    flex: none;
    min-inline-size: 44px;
    font-size: 22px !important;
    line-height: 1;
  }

  /* -------------------------------- List rows -------------------------------- */

  /* The books and adventures lists keep upstream's columns, which a phone is too narrow for (a Persian date alone is
     wider than its column): the name takes a line of its own, stacked with its English, and the other columns sit
     beneath it, wrapping between columns. The name column is `.ve-col-8-5` in `books.js` and `.ve-col-5-5` in
     `adventures.js`. */
  #listcontainer .list .ve-lst__row-inner > .ve-w-100.ve-flex:has(> :is(.ve-col-8-5, .ve-col-5-5)) {
    flex-wrap: wrap;
    gap: 2px 12px;
  }

  /* The columns' wrapper is one item of the row, which every row item otherwise holds at its `min-content`: an
     adventure's name never wraps (below), so that would be the whole name, wider than the screen. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > .ve-w-100.ve-flex:has(> :is(.ve-col-8-5, .ve-col-5-5)) {
    min-inline-size: 0;
  }

  /* An adventure's name keeps upstream's one clipped line (`.ve-mobile-sm__text-clip-ellipsis` is important inside the
     fork's layer, which outranks any rule here). A name left in English is plain text, with no translated title's
     elements: read left to right, it is clipped at its end rather than its start, and still sits at the row's right. */
  #listcontainer .list .ve-lst__row-inner > .ve-w-100.ve-flex > .ve-col-5-5:not(:has(> *)) {
    direction: ltr;
    align-items: safe flex-end;
  }

  #listcontainer .list .ve-lst__row-inner > .ve-w-100.ve-flex > :is(.ve-col-8-5, .ve-col-5-5) {
    display: flex;
    flex: 1 0 100% !important;
    flex-direction: column;
    align-items: flex-start;
    order: -1;
    /* Rows are right to left here, but a Latin name reads as a left-to-right paragraph, where `start` is the left. */
    text-align: right;
    inline-size: 100% !important;
    max-inline-size: 100%;
  }

  #listcontainer
    .list
    .ve-lst__row-inner
    > .ve-w-100.ve-flex:has(> :is(.ve-col-8-5, .ve-col-5-5))
    > :not(.ve-col-8-5, .ve-col-5-5) {
    flex: none !important;
    inline-size: auto !important;
    /* The columns' fixed widths and `.ve-grow` hold from inside the fork's layer; these two sizes outrank both. */
    min-inline-size: max-content;
    max-inline-size: max-content;
    font-size: 13px;
    color: var(--phone-muted);
    white-space: nowrap;
  }

  /* A book's contents rows a finger can pick. */
  #lst-contents .ve-lst__row,
  #lst-contents .ve-lst__row-border {
    min-block-size: 40px;
    display: flex !important;
    align-items: center;
    font-size: 15px;
  }

  /* Rows: the name on its own line at reading size, the columns beneath it as one quiet line. Every row reads right to
     left, as the page does: a name left in English stays on the row's right, with the columns in the same places. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
    row-gap: 2px;
    min-block-size: 52px;
    padding-block: 8px;
    padding-inline: 12px;
    color: var(--phone-muted);
    font-size: 13px;
    line-height: 1.5;
    direction: rtl !important;
  }

  /* Columns take the row's quiet ink; ones upstream colours (a book's code, a spell's school) keep their colour. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > * {
    /* Upstream's column widths are important inside the fork's layer; a flex basis outranks a width. Zero keeps every
       column on the line, in equal shares that line up from row to row; a column with a longer word takes what that
       word needs, so text wraps between words and never inside one. */
    flex: 1 1 0;
    min-inline-size: min-content;
    padding: 0 !important;
    text-align: start !important;
    unicode-bidi: isolate;
  }

  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > .ve-bold {
    flex: 1 0 100%;
    order: -1;
    color: var(--phone-ink);
    font-size: 16px;
    line-height: 1.45;
    white-space: normal !important;
  }

  /* A spell's concentration mark, in a column of one width so the columns after it line up from row to row. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > .ve-col-0-6 {
    flex: 0 0 16px;
  }

  /* A spell's range: "60 فوت" needs more room than a share of the line, and it reads badly over two. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > .ve-col-2-4 {
    flex-grow: 1.6;
  }

  /* The source code closes the line, in a column of its own width. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > [class*="ve-source__"] {
    flex: 0 0 56px;
  }

  /* A row's [+] opens its variants in place. */
  #listcontainer .list:not(#lst-contents) .ve-lst__row-border > .ve-lst__btn-toggle-expand {
    flex: 0 0 32px;
    color: var(--phone-ink);
  }

  /* The English name, under the translated one, from the reader's gloss level (`showEnglishNames`). */
  .site-row-english {
    display: block;
    color: var(--phone-muted);
    font-size: 13px;
    font-weight: 400;
  }

  .site-row-english .i18n__name-original {
    margin-inline-start: 0;
  }

  /* On a fresh load upstream selects the first row to show beside the list; on a phone nothing is beside it, and the
     highlight read as a choice the reader had made. Once the reader opens an entry it marks the one they read. */
  :root:not([data-site-phone-picked]) #listcontainer .list .list-multi-selected {
    box-shadow: none !important;
  }

  :root:not([data-site-phone-picked]) #listcontainer .list .list-multi-selected .ve-lst__row-border {
    border-color: var(--phone-line) !important;
  }

  /* -------------------------------- An entry -------------------------------- */

  /* A heading's English never wraps on a desktop column; a long one would widen the page here. */
  #pagecontent .i18n__gloss-text {
    white-space: normal !important;
  }

  #pagecontent .ve-rd__h > .entry-title-inner {
    min-inline-size: 0;
    overflow-wrap: anywhere;
  }

  /* Upstream sizes the table as a column beside the list; moved to the class, it takes the class's width. */
  #classtable {
    inline-size: 100% !important;
    max-inline-size: 100%;
    flex: none !important;
    margin-block-end: 12px;
  }

  /* Entries and books at a size a phone reads comfortably; upstream's 12.6px suits a desktop column. */
  #pagecontent.ve-stats {
    font-size: 15px;
    line-height: 1.75;
  }

  #pagecontent .ve-rd__h--0 > .entry-title-inner {
    font-size: 26px;
    line-height: 1.4;
  }

  /* The title on a line of its own, its English and its source beneath it, instead of three columns side by side that
     left the title a third of the screen. */
  #pagecontent .ve-stats__th-name > .ve-split-v-end {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }

  /* `.ve-split-v-end` keeps `align-items: flex-end` from the fork's layer, which would send a short name to the far
     side; these take the whole line whatever it says. */
  #pagecontent .ve-stats__th-name > .ve-split-v-end > * {
    align-self: stretch;
  }

  #pagecontent .ve-stats__th-name .ve-flex-v-center:has(> .ve-stats__h-name) {
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 10px;
  }

  #pagecontent .ve-stats__h-name {
    flex: 1 0 100%;
    font-size: 24px;
    line-height: 1.35;
  }

  #pagecontent .ve-stats__th-name .i18n__name-original {
    margin-inline-start: 0;
    font-size: 14px;
  }

  #pagecontent .ve-stats__wrp-h-source {
    justify-content: flex-start;
    font-size: 13px;
  }

  /* A creature's token floats beside its name at 110px, which left the name a third of a phone's width; one that does
     not load (it comes from upstream's image host) shows no alt text over the title. A stat block's token sits beside
     the entry (`#wrp-pagecontent`), not in it, and is sized by its box: its image carries an inline maximum. At full
     size it covered the start of lines that read toward it. Only while it rests: upstream enlarges it on hover, which a
     phone gives on a tap and ends on a tap elsewhere. */
  #pagecontent img.token,
  #wrp-pagecontent .ve-stats__wrp-token:not(:hover) {
    max-inline-size: 72px;
  }

  #pagecontent img.token,
  #wrp-pagecontent img[alt^="Token Image"] {
    color: transparent;
    font-size: 0;
  }

  #pagecontent .ve-stats__wrp-avoid-token {
    max-inline-size: calc(100% - 80px);
  }

  /* A 2024 stat block's ability scores: upstream's three groups of name, score, modifier and save in a row
     (js/render.js `Renderer.monster._getRenderedAbilityScores_one`) left each value a few pixels, so names ran into
     scores, the headers into each other and the last save off the page. On a phone the table is a grid of two groups,
     the physical row's abilities down the first and the mental row's down the second, under one header each. Its rows
     and cells become the grid's items, placed by their position in upstream's markup; widths are the content's, not
     upstream's percentages of a wide row. */
  #pagecontent table:has(> tbody > tr > .ve-stats-tbl-ability-scores__lbl-abv) {
    display: grid;
    grid-template-columns: max-content repeat(3, 1fr) 10px max-content repeat(3, 1fr);
    row-gap: 2px;
  }

  #pagecontent table:has(> tbody > tr > .ve-stats-tbl-ability-scores__lbl-abv) > tbody,
  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv) {
    display: contents;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv) > td {
    display: flex;
    flex-direction: column;
    justify-content: center;
    inline-size: auto;
    padding: 2px 4px;
  }

  /* The header row's cells fill the first line in order; its spacer keeps the gap between the groups and its third
     group has no column. */
  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):first-child > td {
    grid-row: 1;
    justify-content: flex-end;
    padding-block: 0;
    line-height: 1.3;
  }

  /* "تاس نجات" on one line made its column the widest of the four, and two groups no longer fit a 320px phone. Upstream
     keeps headers on one line with an important utility in its `vetools` layer, which an important rule outside a
     layer cannot beat, so this one joins the layer and wins on specificity. */
  @layer vetools {
    #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):first-child .ve-no-wrap {
      white-space: normal !important;
    }
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):first-child > td:nth-child(n + 10),
  #pagecontent
    tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):not(:first-child)
    > .ve-stats-tbl-ability-scores__lbl-spacer {
    display: none;
  }

  /* Each score row holds three abilities of four cells, a spacer after the first two. */
  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):not(:first-child) > td:nth-child(-n + 4) {
    grid-row: 2;
  }

  #pagecontent
    tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):not(:first-child)
    > td:nth-child(n + 6):nth-child(-n + 9) {
    grid-row: 3;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):not(:first-child) > td:nth-child(n + 11) {
    grid-row: 4;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(2) > td:nth-child(5n + 1) {
    grid-column: 1;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(2) > td:nth-child(5n + 2) {
    grid-column: 2;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(2) > td:nth-child(5n + 3) {
    grid-column: 3;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(2) > td:nth-child(5n + 4) {
    grid-column: 4;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(3) > td:nth-child(5n + 1) {
    grid-column: 6;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(3) > td:nth-child(5n + 2) {
    grid-column: 7;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(3) > td:nth-child(5n + 3) {
    grid-column: 8;
  }

  #pagecontent tr:has(> .ve-stats-tbl-ability-scores__lbl-abv):nth-child(3) > td:nth-child(5n + 4) {
    grid-column: 9;
  }

  /* Upstream's small icon buttons above an entry (pop-out window, filter link, more): desktop tools, unnamed on a
     touch screen. The entry bar shares the entry instead. */
  :root[data-site-phone-view]
  .ve-ui-tab__btn-tab-head:has(> .glyphicon-new-window, > .glyphicon-magnet, > .glyphicon-option-vertical) {
    display: none !important;
  }

  /* -------------------------------- Pins -------------------------------- */

  /* Upstream's confirmations and prompts, sized for a mouse. */
  :root[data-site-phone-view] .ve-ui-modal__inner .ve-btn:not(.ve-btn-xs) {
    min-inline-size: 88px;
    min-block-size: 44px;
    justify-content: center;
  }

  /* "تمرکز" is wider than upstream's column for a mark, so the pinned table's last column gives it room, in its header
     and its rows alike. A flex basis outranks upstream's widths. */
  #sublistsort [data-sort="concentration"],
  :root:has(#sublistsort [data-sort="concentration"]) #sublist .ve-lst__row a > :nth-child(5) {
    flex: 0 0 38px;
  }

  #sublistsort:has([data-sort="concentration"]) [data-sort="range"],
  :root:has(#sublistsort [data-sort="concentration"]) #sublist .ve-lst__row a > :nth-child(6) {
    flex: 1 1 0;
    min-inline-size: 0;
  }

  /* Upstream's pin, + and − above an entry, at a finger's size. A flex basis outranks upstream's width, which is
     important inside the fork's layer. */
  :root[data-site-phone-view] #tabs-right .ve-ui-tab__btn-tab-head {
    flex: 0 0 44px;
    min-block-size: 44px;
    font-size: 18px;
  }

  :root[data-site-phone-view] #tabs-right .ve-ui-tab__btn-tab-head[aria-pressed="true"] {
    color: var(--phone-accent);
  }

  /* A row of bare icons says nothing on a screen without hover, so upstream's toolbar folds behind a chevron that ends
     the list's name (`foldListTools`), the two drawn as one bar, and opens on its own line, where each button names
     itself. A title is too long to fit seven across, hence these short names. */
  .site-list-tools {
    position: relative;
    margin-block: -6px 14px;
  }

  /* Upstream's table keeps its height however few rows it holds, which would part the list's name from its list. */
  :root[data-site-phone-view] #sublistcontainer {
    block-size: auto;
    min-block-size: 0;
    max-block-size: 130px;
  }

  .site-list-tools__toggle {
    position: absolute;
    inset-block-start: var(--site-list-tools-top);
    inset-inline-end: 0;
    display: block;
    inline-size: 44px;
    block-size: 44px;
    border: 0;
    border-inline-start: 1px solid var(--phone-line);
    border-start-end-radius: 10px;
    border-end-end-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-muted);
  }

  .site-list-tools__toggle .glyphicon {
    transition: var(--phone-tuck);
  }

  .site-list-tools__toggle[aria-expanded="true"] .glyphicon {
    transform: rotate(180deg);
  }

  .site-list-tools .ve-flex-v-center:has(> .ve-btn-group > button > .glyphicon-floppy-disk) {
    flex-wrap: wrap;
    gap: 6px;
  }

  .site-list-tools .ve-flex-v-center:has(> .ve-btn-group > button > .glyphicon-floppy-disk) > * {
    flex: 0 0 100%;
    margin-inline: 0 !important;
  }

  .site-list-tools .ve-flex-v-center:has(> .ve-btn-group > button > .glyphicon-floppy-disk) > :first-child {
    flex-basis: calc(100% - 44px);
    min-block-size: 44px;
    padding-inline-start: 12px;
    border-start-start-radius: 10px;
    border-end-start-radius: 10px;
    background: var(--phone-raised);
  }

  .site-list-tools input {
    block-size: 44px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--phone-ink);
    font-size: 16px;
  }

  /* Upstream's group is important inside the fork's layer, which outranks `display: none` here. */
  .site-list-tools:not(.site-list-tools--open) .ve-btn-group:has(> button > .glyphicon-floppy-disk) {
    position: absolute !important;
    visibility: hidden !important;
    inline-size: 0 !important;
    overflow: hidden !important;
  }

  .site-list-tools .ve-btn-group:has(> button > .glyphicon-floppy-disk) > button {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-inline-size: 0;
    min-block-size: 52px;
    padding-inline: 0;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .site-list-tools button:has(> .glyphicon-file)::after {
    content: "تازه";
  }

  .site-list-tools button:has(> .glyphicon-duplicate)::after {
    content: "کپی";
  }

  .site-list-tools button:has(> .glyphicon-floppy-disk)::after {
    content: "ذخیره";
  }

  .site-list-tools button:has(> .glyphicon-folder-open)::after {
    content: "فهرست‌ها";
  }

  .site-list-tools button:has(> .glyphicon-download)::after {
    content: "دانلود";
  }

  .site-list-tools button:has(> .glyphicon-upload)::after {
    content: "آپلود";
  }

  .site-list-tools button:has(> .glyphicon-refresh)::after {
    content: "برگشت";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-file)::after {
    content: "New";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-duplicate)::after {
    content: "Copy";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-floppy-disk)::after {
    content: "Save";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-folder-open)::after {
    content: "Lists";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-download)::after {
    content: "Download";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-upload)::after {
    content: "Upload";
  }

  :root.i18n--english .site-list-tools button:has(> .glyphicon-refresh)::after {
    content: "Revert";
  }

  .site-my-lists:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 8px;
    inline-size: 100%;
    min-block-size: 44px;
    margin-block-end: 8px;
    padding-inline: 12px;
    border: 0;
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font-size: 15px;
  }

  .site-saved-lists__close {
    flex: none;
    inline-size: 44px;
    block-size: 44px;
    margin-inline-start: auto;
    border: 0;
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
  }

  /* Upstream's saved lists window on a phone (`js/site-phone-pins.js`): a tap on a row previews it, and the
     small ✓ that opens it gets its name. */
  :root[data-site-saved-lists] .ve-ui-modal__inner h4 {
    font-size: 20px;
  }

  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-btn-xs {
    min-inline-size: 44px;
    min-block-size: 44px;
    font-size: 14px;
  }

  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row {
    gap: 4px;
    min-block-size: 56px;
    font-size: 16px;
  }

  /* A flex basis outranks upstream's fixed widths, which are important inside the fork's layer. */
  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row .ve-w-30p {
    flex: 0 0 84px;
  }

  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row .ve-w-50p {
    flex: 0 0 88px;
    margin-inline: 0 !important;
  }

  /* Exporting every list at once and sorting a handful of names are desktop chores. */
  :root[data-site-saved-lists] .ve-ui-modal__inner > .ve-split-v-center > .ve-flex-vh-center,
  :root[data-site-saved-lists] .ve-ui-modal__scroller > .ve-btn-group {
    position: absolute !important;
    visibility: hidden !important;
    inline-size: 0 !important;
    overflow: hidden !important;
  }

  /* Upstream's [+] is a second way to do what a tap on the row does. Its classes are important in the fork's layer. */
  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row > [title].ve-clickable {
    position: absolute !important;
    visibility: hidden !important;
    inline-size: 0 !important;
    overflow: hidden !important;
  }

  :root[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row .ve-btn-primary::after {
    content: "باز کن";
    margin-inline-start: 6px;
  }

  :root.i18n--english[data-site-saved-lists] .ve-ui-modal__inner .ve-lst__row .ve-btn-primary::after {
    content: "Open";
  }

  /* -------------------------------- The filter window -------------------------------- */

  .ve-ui-modal__overlay:has(> .site-filter-window) {
    padding: 0 !important;
  }

  .ve-ui-modal__overlay:has(> .site-filter-window) {
    align-items: flex-start !important;
  }

  /* The two properties follow the visual viewport (js/site-phone-filters.js `_followVisualViewport`). */
  .site-filter-window {
    block-size: var(--site-filter-window-height, 100dvh) !important;
    max-block-size: var(--site-filter-window-height, 100dvh) !important;
    margin: 0 !important;
    transform: translateY(var(--site-filter-window-top, 0));
    border-radius: 0 !important;
    padding-inline: 12px !important;
    background: var(--phone-surface);
  }

  .site-filter-window__head h4 {
    font-size: 20px;
    font-weight: 700;
  }

  .site-filter-window__head input {
    block-size: 44px;
    border-radius: 10px;
    font-size: 16px;
  }

  /* Upstream's expert controls (js/site-phone-filters.js `FilterWindow._tagControls`) and a group's AND/OR switch. */
  .site-filter-window__tucked,
  .site-filter-window .ve-fltr__h--multi > :first-child > .ve-btn {
    display: none;
  }

  .site-filter-window__head .ve-btn {
    min-block-size: 36px;
    font-size: 14px;
  }

  .site-filter-window .ve-ui-modal__scroller {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-block-size: 0;
  }

  .site-filter-window .ve-fltr__dropdown-divider {
    display: none;
  }

  .site-filter-section {
    padding-block: 2px 8px;
    border-block-end: 1px solid var(--phone-line);
  }

  .site-filter-window .ve-fltr__h {
    flex-wrap: wrap;
    align-items: center;
    margin: 0 !important;
  }

  /* A group's own controls and a filter's (shown by its ⋮) wrap onto lines of their own rather than run off the side. */
  .site-filter-window .ve-fltr__h > *,
  .site-filter-window .ve-fltr__h .ve-flex,
  .site-filter-window .ve-fltr__h .ve-flex-v-center {
    min-inline-size: 0;
    max-inline-size: 100%;
    flex-wrap: wrap;
  }

  .site-filter-window .ve-fltr__h--multi > :first-child,
  .site-filter-window .ve-fltr__h-text {
    flex: 1 0 100%;
  }

  /* A filter's name row fills the header, so its ⋮ sits at the far end on every filter; some of upstream's name rows
     are only as wide as their name. Closed, a section is its header alone, whatever kind of filter it holds. */
  .site-filter-window .ve-fltr__h .ve-fltr__h-text {
    min-inline-size: 100%;
  }

  .site-filter-section--closed > :not(.ve-fltr__h) {
    display: none;
  }

  /* Upstream hides a filter's header controls on a phone and offers them behind ⋮, except on the options filter (fork
     `filter-filter-options.js` `_getHeaderControls`), whose reset, hide button and menu stay on the header row and
     spill out of the window. The window's own reset and the section's name cover the first two. The row's
     `.ve-flex-v-center` keeps `display: flex !important` from the fork's layer, so it is taken out of the flow. */
  .site-filter-window
    .ve-fltr__h:not(.ve-fltr__h--multi, :has(.ve-fltr__h-text .glyphicon-option-vertical))
    > :not(.ve-fltr__h-text) {
    position: absolute;
    visibility: hidden;
  }

  .site-filter-section__toggle {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-block-size: 48px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--phone-ink);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    text-align: start;
  }

  .site-filter-section__chevron {
    display: inline-block;
    color: var(--phone-muted);
    font-size: 13px;
    transition: transform 0.15s ease;
  }

  .site-filter-section--closed .site-filter-section__chevron {
    transform: rotate(90deg);
  }

  /* Each filter's own Hide button and the summary it shows while hidden: the name opens and closes the section. */
  .site-filter-window .ve-fltr__h .ve-btn-group.ve-ml-2:last-child > button:first-child:not(:has(.glyphicon)),
  .site-filter-window .ve-fltr__summary_item {
    display: none !important;
  }

  .site-filter-window .ve-fltr__pill {
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1.4;
  }

  /* A group's header (the Classes filter, say): the name row like any filter's, with the ⋮ at its far end, and the
     group's one reader-facing switch under it. Its "reset all" repeats the window's own clear button. */
  .site-filter-window .ve-fltr__h--multi {
    position: relative;
  }

  .site-filter-window .ve-fltr__h--multi > :last-child {
    justify-content: flex-start;
    inline-size: 100%;
  }

  .site-filter-window .ve-fltr__h--multi > :last-child > .ve-btn-group {
    position: absolute;
    inset-block-start: 6px;
    inset-inline-end: 0;
    margin: 0 !important;
  }

  .site-filter-window .ve-fltr__h--multi > :last-child > .ve-flex > .ve-btn {
    display: none !important;
  }

  .site-filter-window .ve-fltr__h--multi .ve-mr-2 {
    margin-inline-end: 0 !important;
  }

  .site-filter-section--closed .ve-fltr__h--multi > :last-child > .ve-flex {
    display: none !important;
  }

  .site-filter-window .ve-fltr__h--multi > :last-child > .ve-btn-group > .ve-btn {
    min-block-size: 36px;
    padding-inline: 12px;
  }

  /* -------------------------------- A filter's search picker -------------------------------- */

  .site-filter-window .ve-fltr-search__wrp-search {
    margin: 4px 0 8px !important;
  }

  .site-filter-window .ve-fltr-search__wrp-search input {
    block-size: 44px;
    padding-inline: 12px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: none;
    color: var(--phone-ink);
    font-size: 16px;
  }

  .site-filter-window .ve-fltr-search__wrp-values {
    max-block-size: 240px;
    margin-block-start: 4px;
    border-color: var(--phone-line);
    border-radius: 10px;
  }

  .site-filter-window .ve-fltr-search__wrp-row {
    gap: 4px;
    min-block-size: 44px;
    border-block-end: 1px solid var(--phone-line);
  }

  .site-filter-window .ve-fltr-search__btn-activate {
    inline-size: 32px;
    block-size: 32px;
    border-radius: 6px;
    font-size: 16px;
  }

  .site-filter-window .ve-fltr-search__disp-name {
    margin-inline-start: 8px;
    font-size: 15px;
  }

  /* -------------------------------- The window's last line -------------------------------- */

  .site-filter-window__footer {
    position: sticky;
    inset-block-end: 0;
    display: flex;
    gap: 8px;
    margin-inline: -12px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: var(--phone-surface);
    box-shadow: 0 -1px 0 var(--phone-line);
  }

  .site-filter-window__clear {
    display: flex;
    flex: none;
    align-items: center;
    gap: 6px;
    min-block-size: 48px;
    padding-inline: 14px;
    border: 1px solid var(--phone-line);
    border-radius: 12px;
    background: none;
    color: var(--phone-ink);
    font: inherit;
    font-size: 15px;
  }

  .site-filter-window__clear-icon {
    font-size: 14px;
  }

  .site-filter-window__show {
    flex: 1;
    min-block-size: 48px;
    border: 0;
    border-radius: 12px;
    background: var(--phone-accent);
    color: var(--phone-on-accent);
    font: inherit;
    font-size: 16px;
    font-weight: 700;
  }

  /* -------------------------------- Books: contents in a sheet -------------------------------- */

  :root[data-site-phone-contents] .site-phone-bar--book {
    display: flex;
  }

  :root[data-site-phone-contents="closed"] #listcontainer {
    display: none !important;
  }

  :root[data-site-phone-contents="open"] #listcontainer {
    position: fixed !important;
    z-index: 1100;
    inset: 0;
    display: block !important;
    max-block-size: none !important;
    margin: 0 !important;
    padding: 0 12px 24px !important;
    overflow-y: auto !important;
    background: var(--phone-surface);
  }

  :root[data-site-phone-contents="open"] #lst-contents {
    position: static !important;
    max-block-size: none !important;
    overflow: visible !important;
  }

  :root[data-site-phone-contents="open"] {
    overflow: hidden;
  }

  .site-phone-contents__head {
    position: sticky;
    z-index: 1;
    inset-block-start: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-inline: -12px;
    margin-block-end: 8px;
    padding: 8px 12px;
    background: var(--phone-surface);
    box-shadow: var(--phone-bar-shadow);
  }

  .site-phone-contents__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-block-size: 44px;
    padding-inline: 12px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink);
    font: inherit;
    font-size: 15px;
  }

  .site-phone-contents__all {
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    color: var(--phone-muted);
    font-size: 14px;
    text-decoration: underline;
  }

  .site-phone-contents__all-row {
    display: none;
  }

  /* Upstream's book buttons: "g" and "f" name keyboard keys, and the reading-width switch has no width to switch.
     "View Entire Book" is a slow page load a phone reader rarely wants, so it sits in the three-dots menu
     (`js/site-phone-book.js`). */
  .bk__wrp-btns-open-find kbd,
  button:has(> .glyphicon-resize-small),
  .ve-btn-group > a.ve-btn:has(~ button > .glyphicon-resize-small) {
    display: none !important;
  }

  /* With the entire-book link gone, the top row's group holds only the three dots. Upstream's space-between would leave
     it floating between Previous and Next, so the two steps sit together and the dots take the far end. */
  .ve-split:has(> .ve-btn-group > button > .glyphicon-option-vertical) {
    justify-content: flex-start;
    gap: 8px;
  }

  .ve-split > .ve-btn-group:has(> button > .glyphicon-option-vertical) {
    order: 1;
    margin-inline-start: auto;
  }

  /* -------------------------------- Classes -------------------------------- */

  /* "Select a subclass" scrolls to the subclass buttons (fork `js/classes.js` `_initScrollToSubclassSelection`);
     upstream styles it as a dice roll. */
  [data-jump-select-a-subclass] {
    color: var(--phone-accent) !important;
    text-decoration: underline;
  }

  #subclasstabs {
    scroll-margin-block: 72px;
  }

  #subclasstabs .ve-btn {
    min-block-size: 40px;
    font-size: 14px;
  }

  /* Upstream's subclass presets ("View Default", "View Most Recent"…) and its shuffle: an unlabelled select and icon. */
  .cls-tabs__sel-preset,
  #subclasstabs button:has(> .glyphicon-random) {
    display: none !important;
  }

  /* -------------------------------- Tools -------------------------------- */

  /* The challenge rating calculator puts its inputs and its table side by side. */
  #crcalc > .row {
    flex-direction: column;
  }

  /* The homebrew manager's row of buttons is wider than a phone. */
  #manager .ve-mobile-sm__flex-col > .ve-flex-v-center {
    flex-wrap: wrap;
    row-gap: 6px;
    max-inline-size: 100%;
  }

  #crcalc > .row > * {
    max-inline-size: 100%;
  }

  /* -------------------------------- The menu -------------------------------- */

  .site-phone-quick__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0;
  }

  .site-phone-quick__link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-block-size: 52px;
    padding: 6px;
    border: 1px solid var(--phone-line);
    border-radius: 10px;
    background: var(--phone-raised);
    color: var(--phone-ink) !important;
    font-size: 14px;
    line-height: 1.3;
    text-align: center;
    text-decoration: none !important;
  }

  /* Upstream lays the Menu button and the menu side by side; opened, the menu takes the screen's width beneath it. */
  .page__nav:has(> .page__btn-toggle-nav.ve-active) {
    flex-wrap: wrap;
  }

  .page__nav:has(> .page__btn-toggle-nav.ve-active) > #navbar {
    flex-basis: 100%;
    /* `overscroll-behavior` holds only on a box that can scroll, so the sheet always can. Hiding the root's overflow
       instead would collapse the page's height, which comes from the absolutely placed `.viewport-wrapper`, and lose
       the reader's place. */
    min-block-size: 100dvh;
  }

  /* The open menu is a sheet of its own: the page stays where it was behind it, so closing it returns the reader to
     the search and filters, and the Menu button that closes it stays in reach however long the menu runs. It sits
     above the omnisearch's results (900) and under upstream's modals (1000), which its items open, Settings' Language
     window among them, while it stays open. */
  .page__nav:has(> .page__btn-toggle-nav.ve-active) {
    position: fixed;
    z-index: 995;
    inset: 0;
    align-content: flex-start;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--phone-surface);
  }

  .page__nav:has(> .page__btn-toggle-nav.ve-active) > :is(.page__btn-toggle-nav, .site-beta-row__bar) {
    position: sticky;
    z-index: 1;
    inset-block-start: 0;
  }

  .page__nav > .site-beta-row__bar {
    background: var(--phone-surface);
  }

  /* The common pages, then the rules control, which the rest of a long menu would otherwise push out of sight. */
  .page__nav:has(> .page__btn-toggle-nav.ve-active) > #navbar > .site-phone-quick {
    display: block;
    order: -2;
  }

  #navbar > .site-edition__row {
    order: -1;
  }

  #navbar > li > a {
    min-block-size: 48px;
    display: flex;
    align-items: center;
  }

  /* Upstream floats a menu beside its toggle and shifts it with an inline `left`, which on a phone lands partly off the
     screen and past the sheet's end. A menu opens in the flow instead, under its toggle and as wide as the screen, so
     scrolling the sheet reaches every item. */
  #navbar .ve-dropdown-menu {
    position: static;
    inline-size: auto;
    max-inline-size: 100%;
    max-block-size: none;
    margin: 0;
    box-shadow: none;
    white-space: normal;
  }

  #navbar .ve-dropdown-menu--side {
    padding-inline-start: 16px;
  }

  #navbar .ve-dropdown-menu > li > a {
    min-block-size: 44px;
    display: flex;
    align-items: center;
  }

  /* A recipe sets its ingredients beside its instructions, a third and two thirds of the entry (the fork's
     `RenderRecipes.getRenderedRecipe`), which leaves the ingredients a column of a few letters. Upstream's widths are
     important rules in a cascade layer, which no unlayered rule outranks, so the minimum width raises each part to the
     entry's full width and the two stack, with a rule between them. */
  .ve-rd-plaintext__wrp-root {
    flex-direction: column !important;
  }

  .ve-rd-plaintext__wrp-root > .ve-w-33,
  .ve-rd-plaintext__wrp-root > .ve-w-66 {
    box-sizing: border-box;
    min-inline-size: 100%;
  }

  .ve-rd-plaintext__wrp-root > .ve-w-66 {
    margin-block-start: 12px;
    padding-block-start: 12px;
    border-block-start: 1px solid var(--phone-line);
  }
}
