:root {
    --primaryColor: #2EE6FF;
    --mehColor: #95c1ca;
    --borderColor: #6ea5b0;
    --bgColor: #131f20;
    --panelColor: #090f10;
    --shadowColor: rgba(0,0,0,0.25);
    --scrollbarBorder: 0.5rem solid transparent;
    --safariCheck:0;
    --asciiWidth: clamp(694px, 694px, 833px);
    /* Art height budget, and the value in use (the page script overrides it when typing or on errors) */
    --asciiBase: calc(var(--viewportHeight) - 24.5rem);
    --asciiMaxHeight: var(--asciiBase);
    --mobileTopBarMarginTop: 0;
    --fontSizeS: clamp(0.35rem, 0.4rem, 0.45rem);
    --fontSizeM: clamp(0.4rem, 0.5rem, 0.6rem);
    --fontSizeL: clamp(0.8rem, 1rem, 1rem);
    --sideCardAlpha: 0.5;
    /* The trays' icons (the bookmark tray's and the menu's), the room around each (4px of tray around its pill,
       the rest pill around the icon), and the width of a button's icon box, a little over the icon for the widest */
    --trayIcon: 1.125rem;
    --trayPad: 0.5rem;
    --trayIconBox: calc(var(--trayIcon) + 0.125rem);
    /* Four buttons and the three 2px lines between them */
    --toolsTrayWidth: calc(4 * (var(--trayIconBox) + 2 * var(--trayPad)) + 6px);
    --toolsTrayClosedWidth: 2.25rem;
    /* The trays' height (the menus' and the bookmark's): short enough that a menu clears a full-height card's top
       border on phones, with a small gap */
    --trayHeight: calc(var(--trayIcon) + 0.5625rem + 1px);
    --toolsTrayOffset: calc(-0.25rem - var(--trayHeight));
    --toolsTrayAsciiShrink: calc(0.25rem + var(--trayHeight));
    --toolsButtonHover: 0.375rem;
    /* Spring curves for the bookmark (a gentle settle, and a livelier one for letting go of a press);
       browsers without linear() keep a plain overshoot */
    --springSoft: cubic-bezier(0.34, 1.3, 0.64, 1);
    --springBouncy: cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Slight overshoot, for the tray icons */
    --springTray: cubic-bezier(0.34, 1.12, 0.64, 1);
    --toolsButtonPress: 0.6rem;
    --fsCloseSize: 1.5rem;
    --fsGutter: 1.25rem;
    /* Extra room under the fullscreen close button */
    --fsCloseLift: 1rem;
    --viewportHeight: 100vh;
    /* Every color change: the palette and the hover fades */
    --colorFade: ease-in 0.2s;
    /* The border color dimmed toward the panel, for lines and frames inside a panel (the art's frame, dividers,
       thumbnails); outer frames and controls keep --borderColor. Follows the palette as it fades */
    --dimBorderColor: color-mix(in srgb, var(--borderColor) 55%, var(--panelColor));
}

/* The palette fades as one, so everything that uses it changes in step
   (the page script turns the fade on once the saved color is in place) */
@property --primaryColor { syntax: '<color>'; inherits: true; initial-value: #2EE6FF; }
@property --mehColor { syntax: '<color>'; inherits: true; initial-value: #95c1ca; }
@property --borderColor { syntax: '<color>'; inherits: true; initial-value: #6ea5b0; }
/* How far the style swatch has turned to its chroma rainbow (0% the plain color), so it can fade between them */
@property --chromaMix { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@property --bgColor { syntax: '<color>'; inherits: true; initial-value: #131f20; }
@property --panelColor { syntax: '<color>'; inherits: true; initial-value: #090f10; }

:root.paletteFade {
    transition: --primaryColor var(--colorFade), --mehColor var(--colorFade), --borderColor var(--colorFade),
        --bgColor var(--colorFade), --panelColor var(--colorFade);
}

@supports (transition-timing-function: linear(0, 1)) {
    :root {
        --springSoft: linear(0, 0.01, 0.0375, 0.0792, 0.1318, 0.1925, 0.2589, 0.3287, 0.3999, 0.471, 0.5406, 0.6076, 0.6712, 0.7306, 0.7854, 0.8353, 0.8802, 0.9199, 0.9547, 0.9846, 1.0098, 1.0307, 1.0475, 1.0607, 1.0704, 1.0772, 1.0814, 1.0833, 1.0833, 1.0817, 1.0787, 1.0747, 1.07, 1.0646, 1.0589, 1.053, 1.047, 1.0411, 1.0354, 1.03, 1.0248, 1.0201, 1.0157, 1.0118, 1.0082, 1.0051, 1.0024, 1.0001, 0.9982, 0.9967, 0.9954, 0.9945, 0.9938, 0.9933, 0.9931, 0.993, 0.9931, 0.9933, 0.9936, 0.994, 1);
        --springBouncy: linear(0, 0.0175, 0.0659, 0.1389, 0.2303, 0.3343, 0.4453, 0.5586, 0.67, 0.7759, 0.8736, 0.961, 1.0365, 1.0995, 1.1497, 1.1872, 1.2127, 1.2272, 1.2317, 1.2276, 1.2164, 1.1995, 1.1783, 1.1542, 1.1285, 1.1023, 1.0765, 1.0519, 1.0293, 1.009, 0.9915, 0.9769, 0.9653, 0.9566, 0.9507, 0.9474, 0.9463, 0.9473, 0.9499, 0.9538, 0.9587, 0.9643, 0.9702, 0.9763, 0.9823, 0.988, 0.9932, 0.9979, 1.002, 1.0053, 1.008, 1.0101, 1.0114, 1.0122, 1.0124, 1.0122, 1.0116, 1.0107, 1.0096, 1.0083, 1);
    }
}

/* Hover fades sit out while the palette fades, or they would trail behind it */
:root.paletteChanging #menuButton,
:root.paletteChanging .guideClose,
:root.paletteChanging .slideButton,
:root.paletteChanging .toolsButton svg,
:root.paletteChanging .cardTitle,
:root.paletteChanging .cardAuthor,
:root.paletteChanging #fsInfo a,
:root.paletteChanging #shuffle svg,
:root.paletteChanging #fsClose {
    transition-property: none !important;
}

/* The tray's buttons keep their pop and press but follow color changes directly; a fade restarting on
   every step of RGB mode's drift made their text stutter */
:root.paletteChanging .styleOption {
    transition-property: transform, opacity !important;
}

/* Visible viewport height with mobile browser toolbars shown */
@supports (height: 100svh) {
    :root {
        --viewportHeight: 100svh;
    }
}

@font-face {
    font-family: 'Cascadia Mono';
    src: url('./fonts/CascadiaMono.woff2') format("woff2");
}

@font-face {
    font-family: 'Inconsolata';
    src: url('./fonts/Inconsolata.woff2') format("woff2");
}

/* The slide buttons' hover nudge moves them by left, not transform: a transform animation puts the
   button on a layer of its own, which takes the top bar with it, and the logo then redraws dimmer */
@keyframes nudgeRight {
    0%, 60%, 100% { left: 0; }
    18% { left: 5px; }
    32% { left: -1.5px; }
    44% { left: 0.75px; }
}

@keyframes nudgeLeft {
    0%, 60%, 100% { left: 0; }
    18% { left: -5px; }
    32% { left: 1.5px; }
    44% { left: -0.75px; }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDim {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.3;
    }
}

@keyframes fadeInScale {
    0% {
        -webkit-transform: scale(0.25);
        transform: scale(0.25);
        opacity: 0.25;
    }
    33% {
        -webkit-transform: scale(0.5);
        transform: scale(0.5);
        opacity: 0.5;
    }
    66% {
        -webkit-transform: scale(0.75);
        transform: scale(0.75);
        opacity: 0.75;
    }
    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeInSlideLate {
    0% {
        opacity: 0;
        transform: translateY(-1.25rem) scaleX(0.999);
    }
    66% {
        opacity: 0;
        transform: translateY(-1.25rem) scaleX(0.999);
    }
    85% {
        opacity: 1;
        transform: translateY(0.25rem) scaleX(0.999);
    }
    95% {
        opacity: 1;
        transform: translateY(-0.15rem) scaleX(0.999);
    }
    100% {
        opacity: 1;
        transform: translateY(0rem) scaleX(0.999);
    }
}

@keyframes wiggle {
    0% {
        opacity: 0;
        margin-left: 4px;
    }
    33% {
        opacity: 0.5;
        margin-left: 0px;
    }
    66% {
        opacity: 1;
        margin-left: 4px;
    }
    100% {
        opacity: 1;
        margin-left: 0px;
    }
}

@keyframes pulse {
    0% {
        opacity: 0.25;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.25;
    }
}

/* Initial load intro: panels rise in one after another (the page script removes body.intro after).
   Each rule keeps the element's fadeIn listed so removing the class doesn't restart it */
@keyframes introRise {
    from {
        opacity: 0;
        transform: translateY(1.25rem) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Top bar and prompt slide in from beyond their own screen edges, no fade */
@keyframes introSlideDown {
    from {
        transform: translateY(calc(-100% - 3rem));
    }
    to {
        transform: translateY(0);
    }
}

@keyframes introSlideUp {
    from {
        transform: translateY(calc(100% + 3rem));
    }
    to {
        transform: translateY(0);
    }
}

/* On desktop the bars slide by top instead: a transform animation puts the bar on a layer of its own,
   and when that layer goes away at the end the logo and prompt text redraw with different smoothing.
   Far enough to start off screen (the bars are under 10rem tall) */
@keyframes introDropDown {
    from {
        top: -10rem;
    }
    to {
        top: 0;
    }
}

@keyframes introRiseUp {
    from {
        top: 10rem;
    }
    to {
        top: 0;
    }
}

/* Card art scans in behind a glowing beam when a card enters the gallery or fullscreen.
   A panel-colored cover shrinks away below the beam; clipping the art itself put it on a layer
   of its own, and the text was redrawn half a pixel off when that layer went away */
@keyframes asciiScan {
    from {
        transform: scaleY(1);
    }
    to {
        transform: scaleY(0);
    }
}

@keyframes asciiBeam {
    0% {
        top: 0;
        opacity: 1;
    }
    85% {
        opacity: 1;
    }
    100% {
        top: calc(100% + var(--scanOver));
        opacity: 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    /* fadeIn stays listed (at 0s, so no fade) so removing body.intro doesn't restart it */
    body.intro #topBar {
        animation: 0s 0s normal forwards 1 fadeIn, 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards introSlideDown;
    }

    body.intro #gallery .content {
        animation: 0.3s ease-in 0s normal forwards 1 fadeIn, 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0s backwards introRise;
    }

    body.intro #prompt {
        animation: 0s 0s normal forwards 1 fadeIn, 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards introSlideUp;
    }

    @media (hover: hover) and (pointer: fine) {
        body.intro #topBar {
            animation: 0s 0s normal forwards 1 fadeIn, 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards introDropDown;
        }

        body.intro #prompt {
            position: relative;
            animation: 0s 0s normal forwards 1 fadeIn, 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.12s backwards introRiseUp;
        }
    }

    /* Their contents don't fade either (duration only, so nothing restarts afterwards) */
    body.intro #topBar *, body.intro #prompt * {
        animation-duration: 0s !important;
    }

    /* Cover and beam stack above the art explicitly: iPhone Safari draws the scrolling art on its
       own layer over positioned neighbors that have no z-index. Isolated so it stays in the card */
    #gallery .asciiWrapper, #fsWrapper .asciiWrapper {
        --scanOver: 0.6rem;
        position: relative;
        isolation: isolate;
    }

    #gallery .asciiWrapper::before, #fsWrapper .asciiWrapper::before {
        content: '';
        position: absolute;
        z-index: 1;
        /* A bit bigger than the art, so glyph shadows and the last row aren't clipped. The beam runs that deep too */
        inset: 0 -2px calc(-1 * var(--scanOver));
        background: var(--panelColor);
        transform-origin: bottom;
        transform: scaleY(0);
        pointer-events: none;
        animation: 0.7s cubic-bezier(0.3, 0, 0.25, 1) var(--scanDelay, 0s) backwards asciiScan;
    }

    #gallery .asciiWrapper::after, #fsWrapper .asciiWrapper::after {
        content: '';
        position: absolute;
        z-index: 2;
        left: 0;
        right: 0;
        height: 2px;
        opacity: 0;
        background: var(--primaryColor);
        box-shadow: 0 0 10px 2px var(--primaryColor);
        pointer-events: none;
        animation: 0.7s cubic-bezier(0.3, 0, 0.25, 1) var(--scanDelay, 0s) backwards asciiBeam;
    }

    /* First card waits for its panel to rise */
    body.intro #gallery {
        --scanDelay: 0.1s;
    }
}

/* Covers the viewport; the page script places the card over the card slot */
#scrollLoader {
    display: flex;
    visibility: hidden;
    top: 0;
    left: 0;
    width: 100vw;
    height: var(--viewportHeight);
    position: fixed;
    z-index: 98;
    justify-content: center;
    align-items: center;
    align-content: center;
    pointer-events: none;
    touch-action: none;
    transform: translateX(100%);
    transition: transform cubic-bezier(0.42, 0, 0.58, 1) 0.45s;
}

/* Looks like a card frame; sized and positioned over the card slot by the page script */
#loadingCardWrapper {
    display: flex;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    box-sizing: border-box;
    background: var(--panelColor);
    border: 4px solid var(--borderColor);
    border-radius: 20px;
    box-shadow: 0 0 0 2px var(--shadowColor);
    /* It shares the art's class for its text, not the art's frame: that outline made its border 2px thicker
       than the card it hands off to */
    outline: none;
    padding: 1rem;
    /* Phone scale everywhere (desktop art is larger, but the ? card stays this size) */
    width: min(56vw, 15rem);
    font-size: 0.241rem;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.6s;
}

#loadingCard {
    width: auto;
    overflow: visible;
    padding: 0;
}
/* While searching, the ? pulses */
@keyframes loaderPulse {
    from {
        opacity: 0.45;
    }
    to {
        opacity: 1;
    }
}

/* The ? spins like a coin inside its card */
@keyframes questionSpin {
    from {
        transform: perspective(700px) rotateY(0deg);
    }
    to {
        transform: perspective(700px) rotateY(360deg);
    }
}

#loadingCardWrapper.searching #loadingCard {
    animation: loaderPulse 0.7s ease-in-out infinite alternate, questionSpin 2.4s linear infinite;
}

/* No scrolling while a card loads (stops leftover momentum or snap-back to the previous card) */
/* Changing layouts re-centers in one step (the page script) */
#gallery.settling {
    scroll-behavior: auto !important;
}

#gallery.frozen {
    overflow: hidden !important;
    scroll-behavior: auto !important;
}

/* Scrolling back to the newest card before a load: no snapping mid-scroll */
#gallery.rewinding {
    scroll-snap-type: none !important;
}

/* Scan is off once done (the page script marks it), so Safari can't replay it when the gallery changes */
#gallery .content.scanned .asciiWrapper::before, #gallery .content.scanned .asciiWrapper::after {
    animation: none;
}

/* Card waiting behind the ? card stays hidden until the handoff */
#gallery .contentWrapper.awaiting {
    visibility: hidden;
}

/* A card waiting behind the ? card holds its scan until the handoff */
#gallery .content.scanHold .asciiWrapper::before, #gallery .content.scanHold .asciiWrapper::after {
    animation-play-state: paused;
}
/* end loading spinner */

* {
    touch-action: pan-x pan-y; /*only allow scroll gestures*/
    -webkit-tap-highlight-color: transparent;
    outline: none;
} 

/* body paints --panelColor, #appWrapper paints --bgColor over it. Safari colors its toolbar
   and overscroll areas from body, so those match the top bar and prompt (iOS Safari 26) */
body {
    margin: 0;
    background: #090f10;
    background: var(--panelColor);
    color: var(--primaryColor);
    font-family: 'Cascadia Mono';
    overflow: hidden;
    text-shadow: 0px 1px 1px var(--shadowColor);
    height: 100%;
}

html {
    height: -webkit-fill-available;
}

::-webkit-scrollbar-thumb {
    min-height: 50px;
    border: var(--scrollbarBorder);
    border-radius: 15px;
    background-color: var(--borderColor) !important;
    background-clip: padding-box;
    height: 0px !important;
}

::-moz-scrollbar-thumb {
    min-height: 50px;
    border: var(--scrollbarBorder);
    border-radius: 15px;
    background-color: var(--borderColor) !important;
    background-clip: padding-box;
    height: 0px !important;
}

/* Mobile card scrollbar, positioned by the page script */
.scrollThumb {
    display: none;
    position: absolute;
    border-radius: 15px;
    background-color: var(--borderColor);
    pointer-events: none;
}

::-webkit-scrollbar {
    width: 16px !important;
    height: 0px !important;
}

::-moz-scrollbar {
    width: 18px !important;
    height: 0px !important;
}

::selection {
    color: var(--mehColor) !important;
    background: rgba(255,255,255,0.2) !important;
}

::-moz-selection {
    color: var(--mehColor) !important;
    background: rgba(255,255,255,0.2) !important;
}

.noselect {
    -webkit-touch-callout: none; /* iOS Safari */
      -webkit-user-select: none; /* Safari */
       -khtml-user-select: none; /* Konqueror HTML */
         -moz-user-select: none; /* Old versions of Firefox */
          -ms-user-select: none; /* Internet Explorer/Edge */
              user-select: none; /* Non-prefixed version, currently
                                    supported by Chrome, Edge, Opera and Firefox */
  }

.noClick {
    pointer-events: none;
    touch-action: none;
}

.hideAnimation {
    animation: none !important;
}

a {
    text-decoration: none;
    color: unset;
    padding: 1rem 1rem 1rem 1rem;
    margin: -1rem -1rem -1rem -1rem;
}

.wiggle {
    animation: wiggle ease-in 0.4s;
}

.fadeIn {
    animation: 0.3s ease-in 0s normal forwards 1 fadeIn;
}

.fadeInSlow {
    animation: 0.75s ease-in 0s normal forwards 1 fadeIn;
}

.fadeInScale {
    animation: 0.6s ease-out 0s normal forwards 1 fadeInScale;
}

.pulse {
    animation: 1.25s ease-out 0s normal forwards infinite pulse;
}

/* Move one card along like a swipe (the page script sets the pitch) */
.slideOut {
    -webkit-transform: translateX(calc(var(--slidePitch, 150%) * -1));
    transform: translateX(calc(var(--slidePitch, 150%) * -1));
    transition: transform cubic-bezier(0.25, 0.8, 0.3, 1) 0.4s;
}

.primary {
    color: var(--primaryColor);
}

.meh {
    color: var(--mehColor);
}

.space {
    font-size: 5px;
}

#appWrapper {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    align-items: center;
    height: -webkit-fill-available;
    align-content: center;
    background: var(--bgColor);
}

#topBar {
    /* Always its own layer, so the logo isn't redrawn when a menu opens */
    will-change: transform;
    display: flex;
    background: var(--panelColor);
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    /* Edge to edge, its buttons held to the card's width in the middle */
    align-self: stretch;
    width: auto;
    padding: 0 calc((100% - var(--asciiWidth)) / 2) 0.5rem;
    margin: 0 0 0 0;
    border: none;
    border-bottom: 4px solid var(--borderColor);
    border-radius: 0;
    box-shadow: 0 0 0 2px var(--shadowColor);
    transition: margin 0.3s;
    justify-content: space-between;
    /* Above the gallery, so the Style menu opens over the cards */
    position: relative;
    z-index: 10;
    animation: 0.3s ease-in 0s normal forwards 1 fadeIn;
}

#menuButton {
    /* Inline-block so the press animation can scale it */
    display: inline-block;
    /* As tall as the swatch on the other end of the bar (20px) */
    font-size: 1.75rem;
    /* Its lines sit where the swatch's mirror image would: as far from the bar's edge, at the same height
       (measured on phones; desktop below) */
    position: relative;
    left: 0;
    top: 2px;
    color: var(--mehColor);
    cursor: pointer;
    transition: color var(--colorFade), text-shadow var(--colorFade);
}

/* Drawn after the logo: the ?'s press bounce gives it a layer while it runs, and anything drawn after
   it would get one too (the logo redrew when that layer went away) */
#menuSlot {
    position: relative;
    z-index: 1;
}

#menuButton.active {
    color: var(--primaryColor);
}

/* Help dialog: fixed to the visible viewport; text scrolls if it can't fit */
.guideWrapper {
    display: none;
    opacity: 0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99;
    width: 100vw;
    height: var(--viewportHeight);
    justify-content: center;
    align-items: center;
    align-content: center;
    pointer-events: none;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.guide {
    display: flex;
    z-index: 100;
    box-sizing: border-box;
    width: min(36rem, calc(100vw - 2rem));
    max-height: calc(var(--viewportHeight) - 1rem);
    background: var(--panelColor);
    border: 4px solid var(--borderColor);
    border-radius: 20px;
    --guidePadX: 2rem;
    padding: 1.75rem var(--guidePadX) 1.5rem;
    flex-direction: column;
    align-items: center;
    pointer-events: all;
    /* Not clipped, so a scrollbar can sit on the border the way the cards' do */
    overflow: visible;
    box-shadow: 0 0 0 2px rgb(0 0 0 / 30%);
}

.guideText {
    align-self: stretch;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop scrollbar centered on the dialog's border like a card's: the text runs out through the padding
   and 6px past the border, and pads back in so its lines end where they did (phones draw their own bar) */
body:not(.touchDevice) .guideText {
    align-self: stretch;
    width: auto !important;
    margin-right: calc(-1 * var(--guidePadX) - 10px);
    padding-right: calc(var(--guidePadX) - 6px);
    scrollbar-gutter: stable;
}

/* The title stays put while the rows below it scroll */
.guideHeading {
    flex: none;
    text-align: center;
    margin: 0 0 0.5rem 0;
}

/* Section heading with a rule running off to the right */
.guideText h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.35rem 0;
    font-size: 0.75rem;
    font-weight: normal;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--mehColor);
}

/* The first header sits closer under the dialog's title */
.guideText .helpSection:first-child h3 {
    margin-top: 0.35rem;
}

.guideText h3::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--dimBorderColor);
    opacity: 0.6;
}

/* Key on the left, what it does on the right */
.helpRow {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    column-gap: 1rem;
    align-items: center;
    padding: 0.3rem 0;
}

.helpKey {
    justify-self: start;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--dimBorderColor);
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.2rem;
    color: var(--primaryColor);
    white-space: nowrap;
}

.helpKey.helpGlyph {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.45rem;
}

.helpKey svg {
    height: 0.9rem;
    width: auto;
    fill: var(--primaryColor);
}

/* The bookmark tray's line icons, drawn as they are there */
.helpKey .strokeIcon {
    height: 1rem;
    fill: none;
    stroke: var(--primaryColor);
    stroke-width: 2.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.helpFullscreen .strokeIcon {
    stroke-width: 2.85;
}

.helpDesc {
    color: var(--mehColor);
    font-size: 0.9rem;
    line-height: 1.3rem;
}

/* Desktop and touch wording (the page script adds .touchDevice) */
body.touchDevice .desktopOnly, body:not(.touchDevice) .touchOnly {
    display: none !important;
}

/* Every dialog's close, outlined like the account dialog's other buttons */
.guideClose {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 50%;
    min-height: 44px;
    margin: 1.5rem 0 0 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
    color: var(--primaryColor);
    text-shadow: none;
    background: transparent;
    border: 2px solid var(--borderColor);
    /* Corners at 30% of the height */
    border-radius: 13px;
    cursor: pointer;
    transition: border-color var(--colorFade), background-color var(--colorFade), color var(--colorFade);
}

#helpCredit {
    margin: 1rem 0 0 0;
    font-size: 0.75rem;
    color: var(--mehColor);
    text-align: center;
}

#logo {
    margin: 0.5rem 6rem;
    font-family: 'Cascadia Mono';
    font-size: var(--fontSizeS);
    text-align: center;
}

#styleSlot {
    display: flex;
    align-items: center;
    margin-bottom: -4px;
    position: relative;
}

/* Swatch tray: rgb, chroma and the color picker on one line, hanging from under the top bar's right end.
   Behaves like the card's bookmark tray: a strip slides down from behind the bar, then widens to the
   left as the buttons pop in (closing runs it backwards). Sized for the gap above the card; the page script places it */
/* The tray sits above the bar in a box that starts at the bar's bottom edge and clips the slide, so
   it seems to come out from behind the bar. Kept out from under the bar: anything there puts the
   bar on a layer of its own, and the logo then draws a little dimmer (with room for the outline) */
#styleMenuClip, #mainMenuClip {
    position: fixed;
    /* Above the card area, which sits above the bar on desktop */
    z-index: 12;
    padding: 0 2px 2px;
    overflow: hidden;
    pointer-events: none;
}

#styleMenu, #mainMenu {
    --trayClosedWidth: 1.25rem;
    --trayEaseOut: cubic-bezier(0.22, 1, 0.36, 1);
    --trayEaseIn: cubic-bezier(0.55, 0, 0.75, 0.3);
    position: relative;
    display: flex;
    pointer-events: auto;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
    box-sizing: border-box;
    width: var(--trayClosedWidth);
    /* As tall as the bookmark tray */
    height: var(--trayHeight);
    /* The extra pixel at the bottom */
    padding: 0 0.5rem 1px;
    overflow: hidden;
    background: var(--trayBorder, var(--borderColor));
    /* Round from the start, not squared until it opens */
    border-radius: 0 0 10px 10px;
    transform: translateY(-100%);
    visibility: hidden;
    /* Closing: folds in, then tucks up behind the bar, the two overlapping a little */
    transition: width var(--trayEaseIn) 0.2s, border-radius var(--trayEaseIn) 0.2s, box-shadow var(--trayEaseIn) 0.2s,
        transform var(--trayEaseIn) 0.16s 0.16s, visibility 0s 0.32s;
}

#styleMenu.open, #mainMenu.open {
    width: var(--trayOpenWidth, 12rem);
    border-radius: 0 0 10px 10px;
    box-shadow: 0 0 0 2px var(--shadowColor);
    /* Its outline starts below the bar's border and own 2px shadow (it tucks 1px into the border), so
       the two don't double up at its top corners; the tray itself fills right up to the bar, as the
       bookmark tray does */
    clip-path: polygon(0 0, 100% 0, 100% 3px, calc(100% + 2px) 3px, calc(100% + 2px) calc(100% + 2px),
        -2px calc(100% + 2px), -2px 3px, 0 3px);
    transform: translateY(0);
    visibility: visible;
    /* Opening: drops down, then unfolds to the left before the drop quite settles */
    transition: transform var(--trayEaseOut) 0.2s, width var(--trayEaseOut) 0.3s 0.12s,
        border-radius var(--trayEaseOut) 0.3s 0.12s, box-shadow var(--trayEaseOut) 0.3s 0.12s, visibility 0s;
}

/* Dividers between the menus' buttons, like the tools tray's (:where keeps these as light as a class) */
:where(#styleMenu, #mainMenu) .trayDivider {
    flex-shrink: 0;
    font-family: 'Cascadia Mono';
    font-size: 1rem;
    line-height: 1;
    /* The dim border color, from the tray's own colors (set on the tray for Safari) */
    color: color-mix(in srgb, var(--trayBorder, var(--borderColor)) 55%, var(--trayPanel, var(--panelColor)));
    opacity: 0;
    transform: translateX(var(--slideFrom, 0px));
    transition: transform ease-in 0.15s, opacity ease-in 0.12s;
}

#styleMenu.open .trayDivider, #mainMenu.open .trayDivider {
    opacity: 1;
    transform: none;
    transition: transform var(--trayEaseOut) 0.3s var(--popDelay), opacity ease-out 0.2s var(--popDelay);
}

/* Each divider keeps time with the buttons either side of it */
:where(#styleMenu, #mainMenu) .trayDivider {
    --popDelay: 0.105s;
}

:where(#styleMenu, #mainMenu) .trayDivider:nth-of-type(2) {
    --popDelay: 0.115s;
}

:where(#styleMenu, #mainMenu) .trayDivider:first-of-type {
    --popDelay: 0.125s;
}

/* Plain labels; a dark rounded pill with a primary-colored label (like the bookmark tray's buttons)
   on hover, when a mode is on, or while pick's picker is up */
.styleOption {
    position: relative;
    /* Mono is a label (its color input sits under the tap), so it'd take the page's text shadow that
       the buttons beside it drop */
    text-shadow: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    height: calc(var(--trayHeight) - 7px);
    padding: 0 0.5rem;
    background: transparent;
    border: 0;
    border-radius: 6px;
    font-family: 'Cascadia Mono';
    /* The size of the cards' titles */
    font-size: var(--fontSizeL);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--trayPanel, var(--panelColor));
    cursor: pointer;
    opacity: 0;
    /* Gathered at the last button (mono), by the swatch (the page script measures how far each is from there) */
    transform: translateX(var(--slideFrom, 0px));
    /* Closing, the buttons slide back and fade while the tray folds in, gone before it tucks away */
    transition: transform ease-in 0.15s, opacity ease-in 0.12s, background-color var(--colorFade), color var(--colorFade);
}

/* Opening, the buttons slide out to the left from the last button as the tray unfolds, the way the share
   choices slide out of the share button (at full size throughout). No overshoot, so they stay inside the tray */
#styleMenu.open .styleOption, #mainMenu.open .styleOption {
    opacity: 1;
    transform: none;
    transition: transform var(--trayEaseOut) 0.3s var(--popDelay),
        opacity ease-out 0.2s var(--popDelay), background-color 0.15s, color 0.15s;
}

/* Right to left from the swatch: mono (on by default, so it sits at the end), rgb, chroma, then crt (the
   color modes run from one color to every color, and the screen effect stands apart) */
.styleOption[data-option="mono"] {
    --popDelay: 0.1s;
}

.styleOption[data-option="rgb"] {
    --popDelay: 0.11s;
}

.styleOption[data-option="chroma"] {
    --popDelay: 0.12s;
}

.styleOption[data-option="crt"] {
    --popDelay: 0.13s;
}

/* The trays' colors are set on the trays themselves (the page script), with the palette as the fallback:
   Safari could leave a closed tray's buttons on an old palette color, so a lit button showed a light fill */
.styleOption.on, .styleOption[data-option="mono"]:active {
    background: var(--trayPanel, var(--panelColor));
    color: var(--trayPrimary, var(--primaryColor));
}

/* Pick's own color input covers the button, so a tap opens the picker right there */
/* (.styleOption first, to outweigh the margin the page's inputs take: that hung it 8px down, past the tray's
   bottom, and Chrome's picker then scrolled the tray up to show it) */
.styleOption .pickInput {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    cursor: pointer;
}

.styleOption:focus-visible, .pickInput:focus-visible {
    outline: 1px solid var(--primaryColor);
}

/* Hover fills in dark (no growing, which the tray would clip); a press then squeezes it */
@media (hover: hover) {
    #styleMenu.open .styleOption:hover, #mainMenu.open .styleOption:hover {
        background: var(--trayPanel, var(--panelColor));
        color: var(--trayPrimary, var(--primaryColor));
        transition: transform ease-out 0.1s, opacity 0s, background-color var(--colorFade), color var(--colorFade);
    }
}

@media (hover: hover) {
    #styleMenu.open .styleOption.settled:not(.on):hover, #mainMenu.open .styleOption.settled:not(.on):hover {
        background: transparent;
        color: var(--trayPanel, var(--panelColor));
    }
}

#styleMenu.open .styleOption:active, #mainMenu.open .styleOption:active {
    transform: scale(0.9);
    transition: transform ease-out 0.08s, opacity 0s, background-color var(--colorFade), color var(--colorFade);
}

/* Tooltips: the button's data-tip in a small dark label above it (below near the top), after a
   moment's hover; mouse only. the page script places it */
#tooltip {
    position: fixed;
    z-index: 200;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    background: var(--panelColor);
    box-shadow: 0 0 0 1.5px var(--borderColor), 0 2px 6px var(--shadowColor);
    font-family: 'Cascadia Mono';
    font-size: 0.75rem;
    line-height: 1.25;
    width: max-content;
    max-width: min(18rem, calc(100vw - 16px));
    white-space: normal;
    /* A long unbroken word (a title of one) wraps instead of running out of the label */
    overflow-wrap: anywhere;
    text-align: center;
    color: var(--primaryColor);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px) scale(0.92);
    transition: opacity ease-in 0.1s, transform ease-in 0.1s;
}

#tooltip.below {
    transform: translateY(-4px) scale(0.92);
}

#tooltip.show {
    opacity: 1;
    transform: none;
    transition: opacity ease-out 0.15s, transform var(--springBouncy) 0.25s;
}

#styleWrap {
    justify-self: end;
    align-self: end;
}

#styleWrap img {
    display: none;
}

#styleButton {
    border-radius: 50%;
    /* Swatch size is the content box: whole pixels at any scaling, or the circle goes oblong. A little bigger
       than the menu icon's 20px, which its lines' length makes look the larger; the padding gives the 2px
       back so the button keeps its size and place */
    box-sizing: content-box;
    height: 22px;
    width: 22px;
    padding: 15px;
    margin: -1rem -1rem -1.2rem -1rem;
    border: 0;
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

/* Ring, gap and the current color, like the picker's own swatch */
.swatchFill {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border: 4px solid var(--mehColor);
    border-radius: 50%;
    /* The ring's color is set on the swatch (the page script), like the trays' */
    box-shadow: inset 0px 0px 0px 2px var(--trayPanel, var(--panelColor));
    /* The chroma rainbow, each stop mixed with the plain color by --chromaMix: all plain color when off, so
       turning chroma on or off fades between them. Spans the whole circle, ring included, so hover uncovers
       more of it instead of repeating it */
    background: conic-gradient(
        color-mix(in srgb, #ff4d5e var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #ffb84d var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #f4ff4d var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #4dff88 var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #4dd8ff var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #6b4dff var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #e14dff var(--chromaMix), var(--primaryColor)),
        color-mix(in srgb, #ff4d5e var(--chromaMix), var(--primaryColor)));
    background-origin: border-box;
    background-repeat: no-repeat;
    transition: border 0.3s, box-shadow 0.3s, --chromaMix 0.5s ease-out;
}

/* Chroma mode: the swatch shows a rainbow (the page script sets the class) */
#styleButton.chroma .swatchFill {
    --chromaMix: 100%;
}

#centerWrapper {
    display: flex;
    align-items: center;
}

/* Desktop: the card area is drawn above the top bar (they never meet; the card sits well below it).
   Its animations (cards rising in, new cards sliding, the ? card, the bookmark) otherwise pulled the bar
   onto a layer of its own while they ran, and the logo drew dimmer until they ended */
@media (hover: hover) and (pointer: fine) {
    #centerWrapper {
        position: relative;
        z-index: 11;
    }
}

.slideGlyph {
    position: relative;
}

.slideButton {
    display: none;
    position: relative;
    /* The arrows' own font: rounder than the page's */
    font-family: 'Inconsolata', monospace;
    font-size: 3rem;
    font-weight: bold;
    height: 1.5rem;
    width: 1.5rem;
    cursor: pointer;
    color: var(--mehColor);
    align-items: center;
    z-index: 5;
    text-shadow: 0 2px 0 var(--shadowColor);
    justify-content: center;
    animation: 0.3s ease-in 0s normal forwards 1 fadeIn;
    transition: color var(--colorFade), text-shadow var(--colorFade);
}

#slideLeft {
    padding: 1.15rem;
    opacity: 0.3;
    pointer-events: none;
    animation: 0.3s ease-in 0s normal forwards 1 fadeInDim;
}

#slideRight {
    padding: 1.15rem;
}

/* More room between the arrows and the card where the screen has it */
@media (hover: hover) and (min-width: 1000px) {
    #slideLeft {
        margin-right: 1.5rem;
    }

    #slideRight {
        margin-left: 1.5rem;
    }
}

#galleryContainer {
    overflow: visible;
}

#gallery {
    display: flex;
    /* align-items: center; */
    align-items: stretch;
    justify-content: start;
    width: calc(var(--asciiWidth) + 2.5rem + 14px);
    scroll-behavior: smooth;
    overflow: scroll;
    overflow-y: hidden;
    scroll-snap-type: inline mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0.65rem 0 0.65rem 0;
    padding-left: 6px;
}

.contentWrapper {
    display: flex;
    padding: 1.25rem 0 1.25rem 0;
    overflow: visible;
    flex-direction: column;
    justify-content: center;
    z-index: 0;
}

/* No room to scroll before the first card: the gallery starts centered on it. Room there let a swipe back
   leave it off center, short of its snap point. The whole card (bookmark and tray too) moves back over its
   left margin, which stays as wide as the right one so they stay centered on it */
#gallery .contentWrapper:first-child {
    margin-left: -80px;
}

.content {
    background: var(--panelColor);
    scroll-snap-align: center;
    scroll-snap-stop: always;
    width: var(--asciiWidth);
    border: 4px solid var(--borderColor);
    border-radius: 20px;
    padding: 1.25rem;
    margin-right: 80px;
    margin-left: 80px;
    box-shadow: 0 0 0 2px var(--shadowColor);
    z-index: 1;
}

/* The art's frame: an outline, so it takes no room and every measurement of the box stays as it was. It's
   drawn over everything in the box, so the scan beam's cover doesn't hide it */
.asciiWrapper {
    overflow: visible;
    font-size: var(--fontSizeM);
    width: var(--asciiWidth);
    outline: 2px solid var(--dimBorderColor);
    border-radius: 6px;
}

/* CRT mode (typed crt or the Style menu): the whole app on an old tube monitor. One screen over
   everything (#crtScreen): scanlines, a dark rim and a glass sheen, a faint band rolling down and static
   flickering, with the text glowing beneath. Saved images and the terminal stay plain */
/* Hidden when off; shown while on, and while it fades out after (the page script adds .closing).
   It covers everything, but fades away toward the very top and bottom (a mask over all of it, the sweep
   included), so the screen's edges keep the bars' own panel color and run on seamlessly into the
   browser's toolbars (Safari tints them from what's at the page's edges) */
#crtScreen {
    display: none;
    position: fixed;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
    /* As tall as the page (the visible height with the toolbars shown), not the edges: iPhone Safari's
       layout runs on under its toolbar, which it paints as a solid band of the edge color, so a screen to the
       edges faded out unseen beneath it and met the band in a hard line */
    top: 0;
    left: 0;
    right: 0;
    height: var(--viewportHeight);
    /* Over everything, dialogs included; it never takes a click */
    z-index: 1000;
    overflow: hidden;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgb(0 0 0 / 25%) 0 1px, transparent 1px 3px);
}

/* The glass: rim, sheen and static */
#crtGlare {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background:
        radial-gradient(ellipse 60% 40% at 25% 10%, rgb(255 255 255 / 6%), transparent 70%),
        radial-gradient(ellipse at center, transparent 60%, rgb(0 0 0 / 40%) 100%);
    box-shadow: inset 0 0 60px rgb(0 0 0 / 55%);
}

/* It comes on through its power-on (below), never a plain fade */
body.crtMode #crtScreen {
    display: block;
}

/* CRT glow: a blurred, brightened copy of the page. Outside the screen's mask, which would hide it */
body.crtMode::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    -webkit-backdrop-filter: blur(3px) brightness(1.7);
    backdrop-filter: blur(3px) brightness(1.7);
    opacity: 0.28;
    /* Faded at the top and bottom so the bars meet Safari's toolbars cleanly */
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
}

/* Its own animation: the fade-in run in reverse doesn't restart (same name), so it would vanish at once */
#crtScreen.closing {
    display: block;
    animation: crtFadeOut 0.6s ease-in forwards;
}

/* A soft band drifts down the screen now and then: each pass its own speed and height, with a pause of
   its own before the next (the page script picks them); it waits above the screen in between */
/* The sweep, down the whole screen */
#crtSweep {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

#crtSweep::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: var(--rollHeight, 30%);
    background: linear-gradient(to bottom, transparent, rgb(255 255 255 / 3%) 50%, transparent);
    transform: translateY(-100%);
}

#crtScreen.rolling #crtSweep::before {
    animation: crtRoll var(--rollTime, 7s) linear;
}

/* Static that flickers: a noise tile over the screen, its pattern jumped about. The sheet stays the screen's
   size: a bigger one moved around showed Safari strips it hadn't drawn yet, a frame of darker static at the
   bottom */
#crtGlare::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.06;
    animation: crtStatic 0.4s steps(1) infinite;
}

/* A gentle flicker now and then: the tube dims for a moment, sometimes twice, at uneven times (two cycles of
   different lengths, so it never settles into a beat). Only its opacity changes, so nothing is redrawn */
#crtScreen::before, #crtScreen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 4%);
    opacity: 0;
    pointer-events: none;
}

body.crtMode #crtScreen::before {
    animation: crtFlicker 11s ease-in-out infinite;
}

body.crtMode #crtScreen::after {
    animation: crtFlicker 17s 4s ease-in-out infinite;
}

/* The text glows in its own color (not in saved images, which are drawn outside these) */
body.crtMode #appWrapper, body.crtMode #fsWrapper, body.crtMode .guideWrapper {
    text-shadow: 0 0 5px color-mix(in srgb, currentColor 55%, transparent);
}

body.crtMode #gallery .ASCII, body.crtMode #fsWrapper .ASCII {
    text-shadow: 0 0 5px color-mix(in srgb, currentColor 55%, transparent);
}

/* Chroma art keeps clear of the theme color, so its glow is a soft white of its own */
body.crtMode #gallery .ASCII.chroma, body.crtMode #fsWrapper .ASCII.chroma {
    text-shadow: 0 0 5px rgb(255 255 255 / 22%);
}

/* Power-on: the tube warms up. The screen fades quickly to the dark panel color, a thin bright line draws across the middle,
   opens out into a flash that fills the screen, a few frames tear and flicker with static, and the
   picture settles in. Each time it's switched on, the first paint included (the page script adds
   .poweringOn; the server does on a first paint with it on) */
/* Its own layer beside the screen, outside the screen's fade at the top and bottom, so it covers the bars too */
#crtPower {
    display: none;
    position: fixed;
    /* The page's height, as the screen above (the band under Safari's toolbar is the panel color already) */
    top: 0;
    left: 0;
    right: 0;
    height: var(--viewportHeight);
    z-index: 1002;
    pointer-events: none;
    /* The panel color, not black: Safari's toolbars already wear it, so they stay in step through the
       warm-up (a black screen left them black or trailing behind) */
    background: var(--panelColor);
}

/* The beam and tearing, fading out at the top and bottom as the screen does, so the flash eases into Safari's
   toolbar bands instead of stopping at them. The cover above runs to the edges: it's the bands' own color */
#crtFlash {
    position: absolute;
    inset: 0;
    -webkit-mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
    mask-image: linear-gradient(to bottom, transparent, black 3rem, black calc(100% - 3rem), transparent);
}

body.crtMode #crtScreen.poweringOn {
    animation: none;
}

#crtScreen.poweringOn ~ #crtPower {
    display: block;
    animation: crtPowerCover 0.95s linear forwards;
}

/* A first paint starts dark */
#crtScreen.poweringOn.fromDark ~ #crtPower {
    animation-name: crtPowerCoverDark;
}

/* The beam: a line across the middle that opens out into the flash */
#crtFlash::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    margin-top: -1px;
    background: color-mix(in srgb, var(--primaryColor) 35%, white);
    box-shadow: 0 0 14px 3px color-mix(in srgb, var(--primaryColor) 70%, white);
    transform: scaleX(0);
    animation: crtPowerBeam 0.95s cubic-bezier(0.3, 0, 0.2, 1) forwards;
}

/* Tearing: a few bright bands that jump sideways for a handful of frames */
#crtFlash::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        transparent 18%, color-mix(in srgb, var(--primaryColor) 30%, transparent) 18% 19.5%,
        transparent 19.5% 47%, rgb(255 255 255 / 14%) 47% 48%,
        transparent 48% 71%, color-mix(in srgb, var(--primaryColor) 22%, transparent) 71% 73%, transparent 73%);
    opacity: 0;
    animation: crtPowerTear 0.95s steps(1) forwards;
}

/* The static bursts as the picture comes in, then settles to its usual faint flicker */
#crtScreen.poweringOn #crtGlare::after {
    animation: crtStatic 0.4s steps(1) infinite, crtStaticBurst 1.05s ease-out;
}

/* A quick fade to dark first (the set switching off its old picture), then the tube comes up through it */
@keyframes crtPowerCover {
    0% { opacity: 0; animation-timing-function: ease-in; }
    15% { opacity: 1; }
    42% { opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1); }
    70% { opacity: 0.12; }
    100% { opacity: 0; }
}

@keyframes crtPowerCoverDark {
    0%, 42% { opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.2, 1); }
    70% { opacity: 0.12; }
    100% { opacity: 0; }
}

@keyframes crtPowerBeam {
    0%, 17% { transform: scaleX(0) scaleY(1); opacity: 1; }
    31% { transform: scaleX(1) scaleY(1); opacity: 1; }
    39% { transform: scaleX(1) scaleY(2); opacity: 1; }
    59% { transform: scaleX(1) scaleY(320); opacity: 0.45; }
    78%, 100% { transform: scaleX(1) scaleY(480); opacity: 0; }
}

@keyframes crtPowerTear {
    0%, 46% { opacity: 0; transform: none; }
    50% { opacity: 1; transform: translate(-10px, 0); }
    54% { opacity: 1; transform: translate(14px, 3%); }
    58% { opacity: 0.8; transform: translate(-5px, -2%); }
    63% { opacity: 1; transform: translate(8px, 6%); }
    68%, 100% { opacity: 0; transform: none; }
}

/* Eased in and out over a few frames, like a tube's brightness wavering, never a hard blink */
@keyframes crtFlicker {
    0%, 36%, 40%, 62%, 64.5%, 100% { opacity: 0; }
    37% { opacity: 0.8; }
    37.8% { opacity: 0.35; }
    38.8% { opacity: 0.7; }
    63.2% { opacity: 0.5; }
}

@keyframes crtStaticBurst {
    0%, 45% { opacity: 0.06; }
    56% { opacity: 0.32; }
    76% { opacity: 0.14; }
    100% { opacity: 0.06; }
}

@keyframes crtFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes crtFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* The glow comes and goes with the screen */
#appWrapper, #fsWrapper, .guideWrapper {
    transition: text-shadow 0.6s ease-out;
}

@keyframes crtRoll {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(100vh);
    }
}

@keyframes crtStatic {
    0% { background-position: 0 0; }
    25% { background-position: -47px 31px; }
    50% { background-position: 23px -61px; }
    75% { background-position: -71px -17px; }
}

@media (prefers-reduced-motion: reduce) {
    body.crtMode #crtScreen, #crtSweep::before, #crtGlare::after, body.crtMode #crtScreen::before, body.crtMode #crtScreen::after {
        animation: none;
    }

    #crtScreen.poweringOn ~ #crtPower {
        display: none;
    }

    #crtScreen.closing {
        display: none;
    }
}

.ASCII {
    width: var(--asciiWidth);
    max-height: calc(var(--asciiMaxHeight) + var(--asciiExtra, 0px) - var(--asciiTrim, 0px) - var(--promptExtra, 0px));
    /* Matches how phones render the tiny card text (5px lines at 0.241rem) */
    line-height: 1.3;
    padding-right: 30px;
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre;
    text-align: center;
    transition: max-height ease-out 0.3s, text-shadow 0.6s ease-out;
}

.ASCII.chroma {
    /* Nothing here shows the theme color (the lines carry their own), so it stays out of it: a theme
       color change (the accent following each card) redrew all of this art in the frame it happened */
    color: transparent;
}

/* Chroma art is costly to draw (a many-stop gradient behind every line), so on desktop each card's is
   drawn once onto a layer of its own and moved as a picture: redrawn on every frame of paging, it
   crawled. Not on phones: a layer per card at their screens' density runs to ~12MB each, and with a
   gallery of them Safari ran short, threw them away and redrew them, dropping more frames the more cards */
#gallery.preview .ASCII.chroma {
    will-change: transform;
}

/* Chroma lines: each line's gradient (lib/chroma.js) shows through its characters */
.ASCII.chroma > span {
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

/* Title and author share the line about 70/30 */
.cardInfo {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    margin: 1.25rem 0 0 0;
}

/* Overflowing cards with a one-line title give the spare line to the art */
.content.overflowing.singleLineTitle {
    --asciiExtra: 1.4rem;
}

/* Two lines, trimmed to fit by the page script. A long unbroken word wraps too, so it's counted in lines
   and trimmed like the rest instead of running off the right with its closing quote */
.cardTitle {
    display: block;
    overflow-wrap: anywhere;
    max-width: 70%;
    overflow: hidden;
    text-indent: -1.3ch;
    padding-left: 1.3ch;
    line-height: 1.4rem;
    max-height: 2.9rem;
}

.cardTitle * {
    display: inline;
}

.cardAuthor {
    line-height: 1.4rem;
}

.cardTitle, .cardAuthor, .cardAuthorGroup {
    min-width: 0;
}

.cardAuthor, .cardAuthorGroup {
    max-width: 30%;
}

/* A long name is cut short with an ellipsis, its closing bracket still showing */
.cardAuthor, .cardAuthor > a {
    display: flex;
    white-space: nowrap;
}

.cardAuthor > a {
    min-width: 0;
}

.cardAuthor .meh, .cardAuthor .space {
    flex-shrink: 0;
}

.authorName {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cardAuthorGroup > .cardAuthor {
    max-width: 100%;
}

.cardTitle:visited, .cardAuthor:visited {
    color: unset;
}

.toolsButtonWrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    height: 0;
    position: relative;
    top: 0;
    transition: top var(--springSoft) 0.5s;
}

/* Match closed bookmark overhang below open tray */
.toolsButtonWrapper.trayOpen {
    top: -0.2rem;
}

.toolsButton {
    cursor: pointer;
    position: relative;
    /* Raise bookmark */
    top: -0.25rem;
    z-index: -1;
    padding: 0.75rem;
    height: 3rem;
    text-align: center;
    animation: 1.25s 0s normal forwards 1 fadeInSlideLate;
}

.toolsButton svg {
    fill: var(--borderColor);
    height: 3rem;
    padding: 0 0.75rem 0.75rem 0.75rem;
    filter: drop-shadow(0 2px 0 var(--shadowColor));
    -webkit-transform: translateY(calc(0rem + 3px));
    transform: translateY(calc(0rem + 3px)) scaleX(0.999);
    transition: transform var(--springSoft) 0.5s, fill var(--colorFade);
}

.toolsTrayWrapper {
    display: flex;
    justify-content: center;
    position: relative;
    z-index: 0;
    margin-top: var(--toolsTrayOffset);
    visibility: hidden;
    transition: margin ease-out 0.2s;
}

.toolsTray {
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--toolsTrayClosedWidth);
    padding: 0;
    position: relative;
    overflow: hidden;
    background: var(--borderColor);
    border-radius: 0px 0px 10px 10px;
    /* Its outline starts below the card's border and shadow (the tray reaches 0.05rem into the border,
       and the card's shadow runs 2px under it), so it runs on from the border without a seam, like
       the swatch tray from the bar's; the tray itself still fills right up to the border */
    clip-path: polygon(0 0, 100% 0, 100% 3px, calc(100% + 2px) 3px, calc(100% + 2px) calc(100% + 2px),
        -2px calc(100% + 2px), -2px 3px, 0 3px);
    -webkit-transform: translate3d(0,0,0);
    transition: box-shadow ease-out 0.2s 0.2s, border-radius ease-out 0.2s 0.2s, top ease-out 0.2s, width ease-out 0.2s 0.2s;
}

.toolsTray div {
    opacity: 0;
    cursor: pointer;
    /* 4px of tray beside the pill (3px above, 4px below), the rest pill around the icon */
    padding: calc((var(--trayHeight) - 1px - var(--trayIcon)) / 2) var(--trayPad) calc((var(--trayHeight) + 1px - var(--trayIcon)) / 2);
    height: var(--trayIcon);
    -webkit-transform: scale(0.01);
    transform: scale(0.01);
    transition: transform ease-out 0.2s 0.2s, opacity ease-out 0.2s 0.2s;
}

.toolsTray * > svg {
    fill: var(--bgColor);
    height: var(--trayIcon);
}

/* Hover: a dark pill behind the icon, drawn inside the button's box so nothing moves or grows, with
   the icon turning the primary color (the swatch tray's hover) */
.toolsTray .shareButton, .toolsTray .enlargeButton, .toolsTray .saveCardButton, .toolsTray .moreFromButton {
    position: relative;
}

/* Every button the same width, wide enough for the widest icon, so the pills all match and each icon
   sits centered in its own */
.toolsTray .shareButton, .toolsTray .enlargeButton, .toolsTray .saveCardButton, .toolsTray .moreFromButton, .toolsTray .shareChoice {
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--trayIconBox);
}

.toolsTray .shareButton::before, .toolsTray .enlargeButton::before, .toolsTray .saveCardButton::before, .toolsTray .moreFromButton::before, .toolsTray .shareChoice::before {
    content: '';
    position: absolute;
    inset: 3px 4px 4px;
    border-radius: 6px;
    background: var(--panelColor);
    opacity: 0;
    transition: opacity var(--colorFade);
}

.toolsTray .shareButton > svg, .toolsTray .enlargeButton > svg, .toolsTray .saveCardButton > svg, .toolsTray .moreFromButton > span, .toolsTray .shareChoice > svg {
    position: relative;
}

.toolsTray svg {
    transition: fill var(--colorFade);
}

/* Fullscreen and share are drawn in lines, at the same weight */
.toolsTray .strokeIcon {
    /* Hover and press color their line, not a fill */
    fill: none !important;
    stroke: var(--bgColor);
    stroke-width: 2.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke var(--colorFade), fill var(--colorFade);
}

.toolsTray .shareButton:active::before, .toolsTray .enlargeButton:active::before, .toolsTray .saveCardButton:active::before, .toolsTray .moreFromButton:active::before,
.toolsTray.sharing .shareChoice:active::before {
    opacity: 1;
}

.toolsTray .shareButton:active > svg, .toolsTray .enlargeButton:active > svg, .toolsTray .saveCardButton:active > svg, .toolsTray.sharing .shareChoice:active > svg {
    fill: var(--primaryColor);
}

/* Fullscreen's short corner strokes read lighter than share's box and arrow at the same weight */
.toolsTray .enlargeButton > .strokeIcon {
    stroke-width: 2.85;
}

.toolsTray .shareButton:active > .strokeIcon, .toolsTray .enlargeButton:active > .strokeIcon , .toolsTray .saveCardButton:active > .strokeIcon {
    stroke: var(--primaryColor);
}

.toolsTray .moreFromButton:active .strokeIcon {
    stroke: var(--primaryColor);
}

.toolsTray .moreFromButton:active .brandIcon {
    background-color: var(--primaryColor);
}

.toolsTray .moreFromButton:active .sourcePrefix {
    color: var(--primaryColor);
}

@media (hover: hover) {
    .toolsTray .shareButton:hover::before, .toolsTray .enlargeButton:hover::before, .toolsTray .saveCardButton:hover::before, .toolsTray .moreFromButton:hover::before,
    .toolsTray.sharing .shareChoice:hover::before {
        opacity: 1;
    }

    .toolsTray .shareButton:hover > svg, .toolsTray .enlargeButton:hover > svg, .toolsTray .saveCardButton:hover > svg, .toolsTray.sharing .shareChoice:hover > svg {
        fill: var(--primaryColor);
    }

    .toolsTray .shareButton:hover > .strokeIcon, .toolsTray .enlargeButton:hover > .strokeIcon , .toolsTray .saveCardButton:hover > .strokeIcon {
        stroke: var(--primaryColor);
    }

    .toolsTray .moreFromButton:hover .strokeIcon {
        stroke: var(--primaryColor);
    }

    .toolsTray .moreFromButton:hover .brandIcon {
        background-color: var(--primaryColor);
    }

    .toolsTray .moreFromButton:hover .sourcePrefix {
        color: var(--primaryColor);
    }
}

.toolsTray .shareButton {
    position: relative;
    display: flex;
    align-items: center;
}

.toolsTray .shareButton > svg {
    /* Spun and shrunk about their own middle (Safari doesn't assume it for an icon, so the share icon
       drifted up as it turned into cancel) */
    transform-origin: 50% 50%;
    transition: transform var(--springBouncy) 0.35s, opacity ease-out 0.2s, fill var(--colorFade), stroke var(--colorFade);
}

/* Sharing: the share icon spins away into cancel, and link and save spread out from it to either side,
   where fullscreen and more-from were (the page script moves them there and back) */
.toolsTray .shareButton > .cancelIcon {
    position: absolute;
    top: 50%;
    left: 50%;
    height: calc(0.875 * var(--trayIcon));
    translate: -50% -50%;
    opacity: 0;
    transform: rotate(-90deg) scale(0.4);
}

.toolsTray.sharing .shareButton > .shareIcon {
    opacity: 0;
    transform: rotate(90deg) scale(0.4);
}

.toolsTray.sharing .shareButton > .cancelIcon {
    opacity: 1;
    transform: none;
}

.toolsTray .shareChoice {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.toolsTray.sharing .shareChoice {
    pointer-events: auto;
}

/* Heart: an outline until saved, then filled. Faded when the card has no code to save it by */
/* Overrides the line icons' !important fill */
.toolsTray .saveCardButton.saved .heartIcon {
    fill: var(--bgColor) !important;
}

@media (hover: hover) {
    .toolsTray .saveCardButton.saved:hover .heartIcon {
        fill: var(--primaryColor) !important;
    }
}

.toolsTray .saveCardButton.unsavable {
    cursor: default;
}

.toolsTray .saveCardButton.unsavable .heartIcon {
    opacity: 0.4;
}

/* Heartbeat on save */
.toolsTray .saveCardButton.beat .heartIcon {
    animation: heartBeat 0.45s var(--springTray);
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    35% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* The link icon is wide, so it stands a little shorter */
.toolsTray .linkButton > svg {
    height: calc(0.875 * var(--trayIcon));
}


/* More from the card's collection: its source's icon (views/partials/sourceIcon.ejs), as tall as the
   icons beside it, with a small repeat badge over its bottom-right corner. The badge's corner is cut
   out of the icon, so the two never run together, on the tray or on the hover pill. Sized in em from
   the glyph's font size, which follows the tray's icon height */
.toolsTray .moreFromButton > .sourceGlyph {
    --badge: 0.52em;
    --badgeOut: 0.06em;
    display: block;
    position: relative;
    font-size: var(--trayIcon);
    width: 1em;
    height: 1em;
    text-shadow: none;
}

.toolsTray .moreFromButton .sourceIcon {
    display: block;
    width: 1em;
    height: 1em;
    /* A thin ring of tray around the badge, so the icon keeps most of its drawing */
    -webkit-mask-image: radial-gradient(circle at calc(100% - var(--badge) / 2 + var(--badgeOut)) calc(100% - var(--badge) / 2 + var(--badgeOut)),
        transparent calc(var(--badge) / 2 + 0.04em), #000 calc(var(--badge) / 2 + 0.04em + 0.5px));
    mask-image: radial-gradient(circle at calc(100% - var(--badge) / 2 + var(--badgeOut)) calc(100% - var(--badge) / 2 + var(--badgeOut)),
        transparent calc(var(--badge) / 2 + 0.04em), #000 calc(var(--badge) / 2 + 0.04em + 0.5px));
}

.toolsTray .moreFromButton .repeatBadge {
    position: absolute;
    right: calc(-1 * var(--badgeOut));
    bottom: calc(-1 * var(--badgeOut));
    width: var(--badge);
    height: var(--badge);
    /* Heavier lines, so it reads at its size as the icons do at theirs */
    stroke-width: 3.8;
}

/* The thin strokes of a drawing with thick and thin ones (Wikimedia's serif W) */
.toolsTray .moreFromButton .strokeIcon .thin {
    stroke-width: 1.6;
}

/* A brand-kit SVG, in the tray's icon color like the drawings */
.toolsTray .moreFromButton .brandIcon {
    background-color: var(--bgColor);
    transition: background-color var(--colorFade);
    -webkit-mask-image: var(--brandIcon), radial-gradient(circle at calc(100% - var(--badge) / 2 + var(--badgeOut)) calc(100% - var(--badge) / 2 + var(--badgeOut)),
        transparent calc(var(--badge) / 2 + 0.04em), #000 calc(var(--badge) / 2 + 0.04em + 0.5px));
    mask-image: var(--brandIcon), radial-gradient(circle at calc(100% - var(--badge) / 2 + var(--badgeOut)) calc(100% - var(--badge) / 2 + var(--badgeOut)),
        transparent calc(var(--badge) / 2 + 0.04em), #000 calc(var(--badge) / 2 + 0.04em + 0.5px));
    -webkit-mask-size: contain, auto;
    mask-size: contain, auto;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

/* A source with no drawing yet: its prefix, as the button used to show */
.toolsTray .moreFromButton .sourcePrefix {
    font-family: 'Cascadia Mono';
    font-weight: 700;
    font-size: 0.75em;
    line-height: 1.333em;
    width: auto;
    color: var(--bgColor);
    transition: color var(--colorFade);
}

/* The tools tray's dividers: as narrow as their line, so the pills either side sit the same 4px from them as from
   the tray's edges */
.toolsTray .trayDivider {
    padding-left: 0 !important;
    padding-right: 0 !important;
    color: var(--shadowColor);
    display: flex;
    justify-content: center;
    width: 2px;
}

#snapWrapper {
    display: none;
    position: absolute;
    bottom: -500%;
}

#snapshot {
    padding: 3px;
}

/* Only the art can be selected here, so select-all (the page script) takes just the art */
#fsWrapper {
    -webkit-user-select: none;
    user-select: none;
    display: none;
    opacity: 0;
    justify-content: center;
    align-items: center;
    align-content: center;
    flex-direction: column;
    position: absolute;
    top: 0;
    z-index: 99;
    width: 100vw;
    height: var(--viewportHeight);
    background: var(--panelColor);
    touch-action: pinch-zoom;
}

/* Art fills the space above the close button */
#fsWrapper .ASCII {
    -webkit-user-select: text;
    user-select: text;
}

#fsWrapper .content {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    padding: var(--fsGutter) var(--fsGutter) calc(2 * var(--fsGutter) + var(--fsCloseSize) + var(--fsCloseLift)) !important;
}

/* Full, untrimmed title and author under the fullscreen art */
#fsInfo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    max-width: min(100%, 48rem);
    margin-top: var(--fsGutter);
    text-align: center;
    line-height: 1.4rem;
    animation: 0.3s 0s normal forwards 1 fadeIn;
}

/* Title/author links dim on hover, only on real hover devices (a tap would leave them dimmed) */
.cardTitle, .cardAuthor, #fsInfo a {
    transition: color var(--colorFade);
}

@media (hover: hover) {
    .cardTitle:hover, .cardAuthor:hover, #fsInfo a:hover {
        color: var(--mehColor);
    }
}

/* A tap dims them at once and holds it a moment (the page script marks them pressed, as a tap is over in an
   instant), alongside their press bounce */
.cardTitle.pressed, .cardAuthor.pressed, #fsTitle.pressed a, #fsAuthor.pressed a {
    color: var(--mehColor);
    transition: none;
}

/* The same for the top bar's buttons and shuffle: their hover looks (the page script inlines shuffle's own colors) */
#menuButton.pressed {
    color: var(--primaryColor);
    text-shadow: 0px 1px 1px var(--shadowColor), 0px 0px 2px var(--primaryColor);
    transition: none;
}

.guideClose.pressed {
    background: var(--primaryColor);
    border-color: var(--primaryColor);
    color: var(--panelColor);
    transition: none;
}

#styleButton.pressed .swatchFill {
    border: 4px solid transparent;
    box-shadow: inset 0px 0px 0px 0px transparent;
    transition: none;
}

#shuffle.pressed svg {
    fill: var(--primaryColor) !important;
    filter: drop-shadow(0px 2px 0px var(--shadowColor)) drop-shadow(0px 0px 2px var(--primaryColor)) !important;
    transition: none !important;
}

/* Title and author keep a generous tap area on their outer sides, but only a sliver between them,
   so neither reaches into the other */
#fsTitle a {
    padding-bottom: 0.25rem;
    margin-bottom: -0.25rem;
}

#fsAuthor a {
    padding-top: 0.25rem;
    margin-top: -0.25rem;
}

#fsAuthor {
    font-size: 0.8em;
    line-height: 1.2rem;
}

/* The description: plain dimmed text centered under the title, up to four lines, then it scrolls. Its scrollbar
   is the cards' (it grows in while the pointer is over the fullscreen card), with a matching gutter on the left
   so the text stays centered; phones draw theirs (gallery.js) and get the same room on both sides */
#fsDesc {
    width: 100%;
    max-width: min(100%, 36rem);
    max-height: 5.4rem;
    overflow-y: auto;
    box-sizing: border-box;
    color: var(--mehColor);
    font-size: 0.85rem;
    line-height: 1.35rem;
    text-align: center;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

body.touchDevice #fsDesc {
    padding: 0 1rem;
    scrollbar-gutter: auto;
}

/* The author signs it off below, as far from it as the title is above (the title's taller line leaves it room) */
#fsDesc + #fsAuthor {
    margin-top: 0.15rem;
}


#fsClose {
    position: absolute;
    bottom: calc(var(--fsGutter) + var(--fsCloseLift));
    left: 50%;
    margin-left: calc(var(--fsCloseSize) / -2);
    cursor: pointer;
    padding: 0;
    height: var(--fsCloseSize);
    width: var(--fsCloseSize);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: var(--mehColor);
    box-shadow: 0 2px 0 var(--shadowColor);
    text-align: center;
    animation: 0.3s 0s normal forwards 1 fadeIn;
}

#fsClose svg {
    fill: var(--panelColor);
    /* Thicken X */
    stroke: var(--panelColor);
    stroke-width: 40;
    stroke-linejoin: round;
    height: calc(var(--fsCloseSize) / 2);
    width: calc(var(--fsCloseSize) / 2);
}

/* In the input's column, clear of the shuffle button beside it */
#statusWrapper {
    grid-column: 1;
    padding-right: 1rem;
    padding-bottom: 0.5rem;
}

/* One line, then an ellipsis. A passing message (.passing) gets up to three, and the prompt grows for the others */
#status {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    line-height: 1.45;
    /* The size of the cards' titles */
    font-size: var(--fontSizeL);
    overflow: hidden;
    overflow-wrap: anywhere;
}

#status.passing {
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

#currentMode {
    display: none;
}

#prompt {
    overflow: hidden;
    background: var(--panelColor);
    /* Edge to edge, its contents held to the card's width in the middle */
    align-self: stretch;
    width: auto;
    /* Its resting height (measured: core.js, gallery.js) plus what a longer status needs (--promptExtra, set on
       #appWrapper by tray.js fitPromptToStatus). Natural until measured. It eases as the card's art does (.ASCII
       max-height, which gives up the same amount), so the two move together */
    height: calc(var(--promptRest) + var(--promptExtra, 0px));
    transition: height ease-out 0.3s;
    display: grid;
    /* Held to the bottom: a status that wraps before the prompt has grown runs off the top, never pushing the
       input down (at rest the prompt is as tall as its contents, so this is the same as centered) */
    align-content: end;
    grid-template-columns: 1fr auto;
    grid-template-rows: 1fr auto;
    justify-items: stretch;
    margin: 0 0 0 0;
    padding: 1rem calc((100% - var(--asciiWidth)) / 2) 1rem;
    border: none;
    border-top: 4px solid var(--borderColor);
    border-radius: 0;
    animation: 0.3s ease-in 0s normal forwards 1 fadeIn;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--shadowColor);
}

#mainInput {
    font-size: 1rem !important;
}

#input {
    /* Clipped sideways only: its line is barely taller than the text, so a clip below cut off the
       bottom of the letters (and the cursor) */
    overflow-x: clip;
    overflow-y: visible;
    position: relative;
    /* Under the status line, with shuffle beside it */
    grid-column: 1;
}

/* Console-style underscore cursor in place of the input's own caret (the page script sizes and places it) */
@keyframes caretBlink {
    50% {
        opacity: 0;
    }
}

#idleCaret {
    position: absolute;
    left: 0;
    top: 0;
    width: 0.6em;
    height: 2px;
    background: var(--primaryColor);
    z-index: 2;
    pointer-events: none;
    animation: caretBlink 1.06s steps(1) infinite;
}

#mainInput {
    caret-color: transparent;
}

/* Gone while a card loads, over a selection, and when typed text sits unfocused */
#input.busy #idleCaret,
#idleCaret.ranged,
#input:not(.focused) #mainInput:not(:placeholder-shown) + #idleCaret {
    visibility: hidden;
}

/* Shuffle types its label into the prompt with the cursor, while the card is fetched */
#input.typing #idleCaret {
    visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
    #idleCaret {
        animation: none;
    }
}

#inputGlyph {
    animation: 0.3s ease-in 0s normal forwards 1 fadeIn;
    position: relative;
    z-index: 1;
    background-image: linear-gradient(90deg, var(--panelColor) 80%, rgba(0,0,0,0) 97%);
    margin-right: -0.75rem;
    padding-right: 0.25rem;
}

#shuffleSlot {
    display: flex;
    align-items: center;
    justify-self: end;
    grid-column-start: 2;
    grid-column-end: 3;
    margin-top: -0.2rem;
    /* Stacked above the top bar (they never overlap): its wiggle and press then can't pull the bar onto a
       layer of its own, which redrew the logo when the layer went away */
    position: relative;
    z-index: 11;
}

#shuffleWrap {
    padding-left: 0.25rem;
    position: relative;
    z-index: 0;
}

#shuffle {
    font-size: 1.5rem;
    z-index: 6;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

#shuffle svg {
    height: 1.5rem;
    fill: var(--mehColor);
    filter: drop-shadow(0px 2px 0px var(--shadowColor));
    transition: fill var(--colorFade), filter var(--colorFade);
}

/* Hover on the wrapper, since a fetch toggles the button's pointer events */
@media (hover: hover) {
    #shuffleWrap:hover #shuffle svg {
        fill: var(--primaryColor);
        filter: drop-shadow(0px 2px 0px var(--shadowColor)) drop-shadow(0px 0px 2px var(--primaryColor));
    }
}

/* One flip per hover (the page script removes the class when it ends) */
#shuffle svg.wiggling {
    animation: shuffleFlip 0.7s var(--springSoft);
}

@keyframes shuffleFlip {
    from { transform: perspective(4rem) rotateY(0deg); }
    to { transform: perspective(4rem) rotateY(360deg); }
}

input, input:active, input:hover, input:focus,
input:focus-within, input:target, input:focus-visible,
input:visited, input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active,
input:-internal-autofill-selected {
    -webkit-background-clip: text;
    background-clip: text;
    border: 0px;
    outline: none;
    background-color: transparent;
    font-family: 'Cascadia Mono';
    font-size: var(--fontSizeL);
    color: var(--primaryColor);
    caret-color: var(--primaryColor);
    margin-top: 0.5rem;
    margin-right: -5%;
    text-shadow: 0px 1px 1px var(--shadowColor);
    width: 90%;
}

[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    margin-top: 2px;
    height: 8pt;
    width: 8pt;
    background-size: 8pt 8pt;
}

[type="search"]::-moz-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    margin-top: 2px;
    height: 8pt;
    width: 8pt;
    background-size: 8pt 8pt;
}

::placeholder {
    color: var(--mehColor);
}

/* Safari/Firefox input styling */
input {
    border: 0;
}
  
input[type="search"] {
    -webkit-appearance: none;
    color: var(--mehColor);
    background-color: transparent;
    font-size: var(--fontSizeL);
    caret-color: var(--primaryColor);
    font-family: 'Cascadia Mono';
    border: 0;
    border-radius: 0;
    padding: 1rem 0 1rem 0;
    margin: -1rem 0 -1rem 0;
    width: calc(100% - 4rem);
}

input[type="search"]::-webkit-search-decoration {
    display: none;
}

/* Phones in portrait */
@media only screen and (max-width: 600px) and (orientation: portrait), only screen and (min-resolution: 200dpi) and (orientation: portrait) {
    :root {
        /* 334px from 375px wide up; narrower phones (360px Androids) scale the art down with the screen so the
           card still fits, keeping 375px's fit (the art's font below scales with it) */
        --asciiWidth: min(334px, calc(100vw - 41px));
        /* Space between top bar and prompt, less card frame, title and gaps (the Safari rule below uses it too) */
        --asciiReserve: calc(11rem - 26.2px);
        --asciiBase: calc(var(--galleryAvail, calc(var(--viewportHeight) - 14.75rem)) - var(--asciiReserve));
        --fontSizeS: clamp(0.25rem, 0.3rem, 0.35rem);
        --fontSizeM: min(0.241rem, calc((100vw - 41px) * 0.011545));
        --fontSizeL: clamp(0.8rem, 0.9rem, 1rem);
        --scrollbarBorder: 0.25rem solid transparent !important;
        /* Larger trays */
        --trayIcon: 1.25rem;
        --trayPad: 0.5625rem;
        /* Larger fullscreen close button */
        --fsCloseSize: 2rem;
        --fsGutter: 0.75rem;
    }

    * {
        scrollbar-width: none;
    }

    /* Web views before Chrome 121 ignore scrollbar-width and keep the 16px bar above, beside the page's own
       thumb (.scrollThumb) and squeezing what's next to it */
    ::-webkit-scrollbar {
        width: 0 !important;
        display: none;
    }

    body {
        font-size: var(--fontSizeL);
    }
    
    #appWrapper {
        align-items: unset;
        min-height: 100%;
        align-content: unset;
        overflow: hidden;
    }

    #topBar {
        display: flex;
        justify-content: space-between;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        width: 100vw;
        padding: 0.5rem 0 0.5rem 0;
        margin-top: var(--mobileTopBarMarginTop);
        border: none;
        border-radius: 0px;
        border-bottom: 4px solid var(--borderColor);
    }

    /* Equal-width sides keep logo centered */
    #menuSlot {
        flex: 1 1 0;
        margin: 0 0 0 1.5rem;
    }

    #menuButton {
        padding: 1rem;
        margin: -1rem;
    }

    .guide {
        --guidePadX: 1.25rem;
        padding: 1.25rem var(--guidePadX) 1rem;
    }

    .helpRow {
        grid-template-columns: 4.75rem 1fr;
        column-gap: 0.75rem;
    }

    #helpCredit {
        margin-top: 0.85rem;
    }

    #logo {
        margin: 0.5rem;
        line-height: 0.35rem;
    }

    #styleSlot {
        flex: 1 1 0;
        justify-content: flex-end;
        margin: 0 1.5rem -4px 0;
    }

    #centerWrapper {
        justify-content: center;
    }
    
    #gallery {
        width: 100vw;
        justify-content: revert;
        -webkit-justify-content: start;
        margin: -1rem 0 -1rem 0;
        padding-left: 0;
        /* Card centered between the top bar and prompt, with room below for the bookmark */
        /* Even 33px gaps around a tall card on an iPhone 17 Pro Max (--asciiReserve takes the 5.2px back) */
        padding-top: calc(0.9rem + 2.6px);
        padding-bottom: calc(1.15rem + 2.6px);
    }

    /* Cards sit centered between the top bar and prompt, the same room above as below. The padding
       (even, so it doesn't shift the card) reaches the gallery's clipping edge past the bookmark's tail
       and its press */
    .contentWrapper {
        padding: 2rem 0;
    }

    .content {
        margin-right: 80px;
        margin-left: 80px;
        padding: 1rem;
    }

    /* The gallery spans the screen here: before the first card, just the room that centers it */
    #gallery .contentWrapper:first-child {
        margin-left: calc(max(0px, (100vw - var(--asciiWidth) - 2rem - 8px) / 2) - 80px);
    }

    /* The original's box runs as far past the art as the art's does, so its scrollbar lands on the border too */
    .flipBack .flipPicture:not(.missing) {
        width: calc(var(--asciiWidth) + 26px);
    }

    .ASCII {
        padding-right: 26px;
        /* min-height: var(--asciiMaxHeight); */
        /* min-height: -webkit-fill-available; */
        max-height: calc(var(--asciiMaxHeight) - 0.75rem + var(--asciiExtra, 0px) - var(--asciiTrim, 0px) - var(--promptExtra, 0px));
    }

    .cardInfo {
        margin: 1rem 0 0 0;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .content.overflowing.singleLineTitle {
        --asciiExtra: 1.2rem;
    }

    .cardTitle {
        flex: 0 1 auto;
        min-width: 0;
        /* 60/40 here, so a longer name shows */
        max-width: 60%;
        text-align: left;
        font-size: var(--fontSizeL);
        text-indent: -1.3ch;
        padding-left: 1.3ch;
        max-height: 2.5rem;
        line-height: 1.2rem;
    }

    .cardAuthor {
        font-size: var(--fontSizeL);
        line-height: 1.2rem;
        text-align: right;
        max-width: 40%;
    }

    .cardAuthorGroup {
        max-width: 40%;
    }

    #prompt {
        overflow: hidden;
        background: var(--panelColor);
        width: 100%;
        display: grid;
        align-content: end;
        grid-template-columns: 1fr auto;
        grid-template-rows: 1fr auto;
        justify-items: stretch;
        margin: 0 0 0 0;
        padding: 1rem 1rem 1.5rem 1rem;
        border: 0;
        border-top: 4px solid var(--borderColor);
        border-radius: 0px;
        animation: 0.5s ease-in 0s normal forwards 1 fadeIn;
        flex-shrink: 0;
    }

    #statusWrapper {
        padding-bottom: 0.3rem;
        margin: 0 0 0 0.5rem;
    }

    /* Wiggle from inset position */
    @keyframes wiggle {
        0% {
            opacity: 0;
            margin-left: 0.75rem;
        }
        33% {
            opacity: 0.5;
            margin-left: 0.5rem;
        }
        66% {
            opacity: 1;
            margin-left: 0.75rem;
        }
        100% {
            opacity: 1;
            margin-left: 0.5rem;
        }
    }

    #status {
        max-width: 90vw;
    }

    #input {
        font-size: 1rem !important;
        margin: 0 0 0 1rem;
    }

    /* The shuffle icon sits as far from the right edge as > does from the left */
    #shuffleSlot {
        margin-top: -0.3rem;
        margin-right: 1rem;
        margin-bottom: 0;
    }

    #shuffleWrap {
        padding-left: 0;
        margin: -1rem 1rem -1rem -1rem;
    }

    #shuffle, #menuSlot, #styleSlot {
        -webkit-tap-highlight-color: transparent;
    }

    #shuffle {
        font-size: 1.5rem;
        padding-left: 0;
        padding: 1rem;
    }

    /* The strip above the icon takes taps for shuffle too (the prompt clips it at its top) */
    #shuffle::before {
        content: '';
        position: absolute;
        left: -1.25rem;
        right: 0;
        bottom: 100%;
        height: 50vh;
    }


}

@media only screen and (min-width: 600px) {
    .ASCII {
        min-height: unset;
        max-height: calc(var(--asciiMaxHeight) + var(--asciiExtra, 0px) - var(--asciiTrim, 0px) - var(--promptExtra, 0px));
    }
 }

/* Desktop */
@media (hover: hover) and (pointer: fine) and (min-width: 601px) {
    /* The card centered between the bars by its border: the space above the card (the gallery's and the
       card's top padding) is 13px more than what's under its bottom border, so the card area is drawn half that
       higher. With the art's budget (--asciiReserve below), a full-height card's outline (its 2px shadow ring)
       sits 2px under an open menu tray's, and its bottom as far above the prompt; the bookmark's tail hangs into that gap */
    #centerWrapper {
        top: -6.5px;
    }

    /* Inset top bar buttons by an extra 1rem */
    #menuSlot {
        margin: 0 0 0 1rem;
    }

    /* Centered in the bar's visible height */
    #menuSlot, #styleSlot {
        top: 4px;
    }

    /* The swatch's mirror image on desktop, where the two buttons are spaced differently */
    #menuButton {
        left: -6px;
        top: 1.5px;
    }

    #styleButton {
        margin: -1rem 0 -1.2rem -1rem;
    }

    /* Room below tall cards for the bookmark, plus the 4px the tray tucks under the card */
    #gallery {
        padding-bottom: calc(1.4rem + 4px);
        margin-bottom: -0.75rem;
    }

    /* Smaller gaps than on phones, and taller art by as much. A little more above, so an open menu tray clears a
       full-height card's top border (the art gives that up: --asciiReserve below) */
    .contentWrapper {
        padding: calc(0.5rem + 13px) 0 0.5rem;
    }

    /* The room between the bars as measured (gallery.js fitGallerySpace), less the card's frame and the gaps
       around it: on a short window the bars are smaller too, and a fixed budget left the card short and the
       gaps wide */
    :root {
        --asciiReserve: calc(11.5rem - 2.2px);
        --asciiBase: calc(var(--galleryAvail, calc(var(--viewportHeight) - 11.5rem)) - var(--asciiReserve));
    }

    /* Neighboring card previews (toggled by the page script) */
    #gallery.preview {
        --galleryBleed: max(0px, (100vw - (var(--asciiWidth) + 2.5rem + 20px)) / 2);
        /* Plus the padding-left bleed */
        width: calc(var(--asciiWidth) + 2.5rem + 14px + var(--galleryBleed));
        margin: 0 calc(var(--galleryBleed) * -1) -0.75rem;
        padding-left: calc(6px + var(--galleryBleed));
        -webkit-mask-image: linear-gradient(to right,
            rgba(0,0,0,0) 0,
            rgba(0,0,0,0.3) calc(var(--galleryBleed) * 0.5),
            rgba(0,0,0,1) var(--galleryBleed),
            rgba(0,0,0,1) calc(100% - var(--galleryBleed)),
            rgba(0,0,0,0.3) calc(100% - var(--galleryBleed) * 0.5),
            rgba(0,0,0,0) 100%);
        mask-image: linear-gradient(to right,
            rgba(0,0,0,0) 0,
            rgba(0,0,0,0.3) calc(var(--galleryBleed) * 0.5),
            rgba(0,0,0,1) var(--galleryBleed),
            rgba(0,0,0,1) calc(100% - var(--galleryBleed)),
            rgba(0,0,0,0.3) calc(100% - var(--galleryBleed) * 0.5),
            rgba(0,0,0,0) 100%);
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
    }

    /* Gallery slides aside for a new card; its edge fade shifts back so it stays put on screen */
    #gallery.preview.slideOut {
        -webkit-mask-position: var(--slidePitch, 0px) 0;
        mask-position: var(--slidePitch, 0px) 0;
        transition: transform cubic-bezier(0.25, 0.8, 0.3, 1) 0.4s, -webkit-mask-position cubic-bezier(0.25, 0.8, 0.3, 1) 0.4s, mask-position cubic-bezier(0.25, 0.8, 0.3, 1) 0.4s;
    }

    /* Spacer so last card can still reach center */
    #gallery.preview::after {
        content: '';
        flex: 0 0 var(--galleryBleed);
    }

    #gallery.preview .contentWrapper {
        transition: opacity 0.3s ease-in;
    }

    /* A card moving aside for a new one fades in step with the slide */
    #gallery.preview.slideOut .contentWrapper {
        transition: opacity 0.4s cubic-bezier(0.25, 0.8, 0.3, 1);
    }

    #gallery.preview .sideCard {
        opacity: var(--sideCardAlpha);
    }

    /* Side cards keep the scrollbar hidden, even one that slid aside mid-hover */
    #gallery.preview .sideCard .content {
        --scrollbarBorder: 0.5rem solid transparent !important;
    }
}

@media (hover: hover) {

    #menuButton:hover {
        color: var(--primaryColor);
        text-shadow: 0px 1px 1px var(--shadowColor), 0px 0px 2px var(--primaryColor);
    }

    #styleButton:hover .swatchFill {
        border: 4px solid transparent;
        box-shadow: inset 0px 0px 0px 0px transparent;
    }

    .slideButton {
        display: flex;
    }

    .slideButton:hover {
        color: var(--primaryColor);
        text-shadow: 0px 2px 0px var(--shadowColor), 0px 0px 2px var(--primaryColor);
    }

    /* One springy nudge toward the slide direction on hover: the glyph moves, not the button, so a
       pointer resting on its edge doesn't slip off and on and restart it */
    #slideLeft:hover .slideGlyph {
        animation: nudgeLeft 1.2s ease-out;
    }

    #slideRight:hover .slideGlyph {
        animation: nudgeRight 1.2s ease-out;
    }

}

/* Safari */
@supports (hanging-punctuation: first) and (font: -apple-system-body) and (-webkit-appearance: none) {
    :root {
        --safariCheck:1;
        /* The measured room between the bars, less the frame and gaps (each layout sets --asciiReserve) */
        --asciiBase: calc(var(--galleryAvail, calc(var(--viewportHeight) - 14.75rem)) - var(--asciiReserve, 10.75rem));
    }
}

/* In the GLYPHICA app (body.nativeApp, with viewport-fit=cover): the page runs under the phone's notch and home
   bar, so the top bar's panel reaches up under the notch and the prompt's down under the home bar, their contents
   clear of both (measured with them: core.js, gallery.js). Safari's toolbar strips below aren't needed there */
body.nativeApp {
    /* The insets the web view reports, or the ones the app sets on the page's root element (--appInsetTop,
       --appInsetBottom, in px) where its web view reports none (docs/native.md) */
    --safeTop: max(env(safe-area-inset-top, 0px), var(--appInsetTop, 0px));
    --safeBottom: max(env(safe-area-inset-bottom, 0px), var(--appInsetBottom, 0px));
}

body.nativeApp #topBar {
    padding-top: calc(0.5rem + var(--safeTop));
}

body.nativeApp #prompt {
    padding-bottom: calc(1.5rem + var(--safeBottom));
}

/* Dialogs sit between the notch and the home bar (their blur still covers the whole screen) */
body.nativeApp .guideWrapper {
    box-sizing: border-box;
    padding: var(--safeTop) 0 var(--safeBottom);
}

body.nativeApp .guide {
    max-height: calc(var(--viewportHeight) - 1rem - var(--safeTop) - var(--safeBottom));
}

/* Fullscreen art and its close button too (the bars' panels behind fill the strips) */
body.nativeApp #fsWrapper {
    top: var(--safeTop);
    height: calc(var(--viewportHeight) - var(--safeTop) - var(--safeBottom));
}

body.nativeApp .safariEdgeFill {
    display: none !important;
}

/* iOS Safari 26+ tints its toolbars from fixed elements touching the viewport edge, ignoring
   theme-color. These --panelColor strips poke ~4px in so both toolbars match. Safari only
   samples elements within ~3-4px of the edge, at least 80% wide and 3px tall: keep those sizes */
.safariEdgeFill {
    display: none;
    position: fixed;
    left: 0;
    width: 100%;
    height: 12px;
    margin: 0;
    padding: 0;
    background-color: var(--panelColor);
    pointer-events: none;
    /* Above everything, CRT's screen included, so they're what Safari samples at the edges */
    z-index: 1001;
}

/* Top strip sits inside the viewport at opacity 0 (Safari still samples it; a strip above
   the viewport reportedly isn't) */
#safariTopFill {
    top: 0;
    height: 6px;
    opacity: 0;
}

#safariBottomFill {
    bottom: -8px;
}

/* iOS only (-webkit-touch-callout), and only in phone portrait, where the top
   bar and prompt span the full width so the 4px strips blend in */
@supports (-webkit-text-size-adjust: none) and (font: -apple-system-body) and (-webkit-touch-callout: none) {
    @media only screen and (max-width: 600px) and (orientation: portrait) {
        .safariEdgeFill {
            display: block;
        }
    }
}
/* The menu button: three lines in the ?'s place, as tall as the swatch on the other end of the bar.
   It opens a tray that mirrors the Style menu, hanging from under the bar's left end (help, account) */
#menuButton {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 0;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

#menuButton .menuIcon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
}

/* The left tray: the Style menu's, unfolding to the right from its first button (help) by the menu button */
#mainMenu {
    justify-content: flex-start;
}

.styleOption[data-option="help"] {
    --popDelay: 0.1s;
}

.styleOption[data-option="account"] {
    --popDelay: 0.11s;
}

/* Its buttons are icons, drawn in lines like the bookmark tray's, in the label color, and sized like that tray:
   as tall, each button as wide, with its pill 4px in from the tray's edges and the lines between */
#mainMenu {
    padding: 0 4px 1px;
}

#mainMenu .styleOption {
    justify-content: center;
    width: calc(var(--trayIconBox) + 2 * var(--trayPad) - 8px);
    padding: 0;
}

#mainMenu .trayDivider {
    width: 10px;
    text-align: center;
}

#mainMenu .menuGlyph {
    display: block;
    width: var(--trayIcon);
    height: var(--trayIcon);
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#mainMenu [hidden] {
    display: none;
}

.styleOption[data-option="favorites"] {
    --popDelay: 0.12s;
}

.styleOption[data-option="upload"] {
    --popDelay: 0.13s;
}

.styleOption[data-option="camera"] {
    --popDelay: 0.14s;
}

.styleOption[data-option="report"] {
    --popDelay: 0.15s;
}

/* Left to right here: each divider between the buttons it sits between */
#mainMenu .trayDivider {
    --popDelay: 0.105s;
}

#mainMenu .trayDivider:nth-of-type(2) {
    --popDelay: 0.115s;
}

#mainMenu .trayDivider:nth-of-type(3) {
    --popDelay: 0.125s;
}

#mainMenu .trayDivider:nth-of-type(4) {
    --popDelay: 0.135s;
}

#mainMenu .trayDivider:nth-of-type(5) {
    --popDelay: 0.145s;
}

/* The account dialog: the help dialog's frame, with its steps swapped in place. The stage holds one step
   at rest and two while they slide past each other; its height eases between them. The report dialog
   lays out its one step the same way */
/* A collection in tiles widens the dialog on a wide screen, so the grid has room */
#accountDialog {
    transition: width 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

#accountDialog:has(.accountPanel:not(.leaving) .collection.tiles) {
    width: min(72rem, calc(100vw - 2rem));
}

#accountDialog .accountStage, #reportDialog .reportStage {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
}

#accountDialog .accountPanel, #reportDialog .reportPanel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 0;
    flex: 1 1 auto;
}

#accountDialog .accountStage.moving {
    overflow: hidden;
}

/* The step on its way out lifts out of the flow, so the dialog measures the one coming in */
#accountDialog .accountPanel.leaving {
    position: absolute;
    inset: 0 0 auto 0;
    pointer-events: none;
}

#accountDialog .accountText, #reportDialog .guideText {
    width: 100%;
}

#accountDialog form, #accountDialog .accountRow {
    margin: 0;
}

/* Delete account's question opens under its button, with the same gap the rows' buttons have */
#accountDialog .accountDanger > .confirmRow {
    margin-top: 0.5rem;
}

.accountRow {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem !important;
}

.accountRow input {
    flex: 1 1 10rem;
}

.accountLabel {
    display: block;
    color: var(--mehColor);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}

.accountLabel input {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
}

/* The prompt's input rule (width 90%, a negative right margin) reaches every input; dialog fields don't take it,
   or a row's button slides over its field */
#accountDialog input, #accountDialog textarea, #reportDialog input, #reportDialog textarea {
    margin: 0;
}

/* Fields in the account and report dialogs (not the report's radio buttons, drawn below) */
#accountDialog input, #accountDialog textarea, #reportDialog textarea, #reportDialog input:not([type="radio"]) {
    box-sizing: border-box;
    min-width: 0;
    font: inherit;
    font-size: 16px;
    color: var(--primaryColor);
    background: var(--bgColor);
    border: 2px solid var(--borderColor);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    outline: none;
    transition: border-color var(--colorFade), box-shadow var(--colorFade);
}

#accountDialog textarea, #reportDialog textarea {
    display: block;
    width: 100%;
    min-height: 4.5rem;
    max-height: 10rem;
    line-height: 1.35;
    resize: vertical;
}

/* One gap under each field label */
#accountDialog .accountLabel > input, #accountDialog .accountLabel > textarea, #accountDialog .accountLabel > .uploadDropzone,
#reportDialog .accountLabel > textarea {
    margin-top: 0.35rem;
}

#accountDialog input:focus, #accountDialog textarea:focus, #reportDialog textarea:focus {
    border-color: var(--primaryColor);
}

.accountLabelRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.charCount {
    font-size: 0.75rem;
    color: var(--mehColor);
    font-variant-numeric: tabular-nums;
}

.charCount.nearLimit {
    color: var(--primaryColor);
}

.charCount.atLimit {
    color: #ff5a5a;
}

/* Upload dropzone, custom choose file button, preview and URL/clipboard paste */
.uploadDropzone {
    position: relative;
    margin-top: 0.35rem;
    padding: 1rem;
    background: var(--bgColor);
    border: 2px dashed var(--dimBorderColor);
    border-radius: 14px;
    text-align: center;
    transition: border-color var(--colorFade), background-color var(--colorFade), box-shadow 0.2s, transform 0.2s;
}

.uploadDropzone.dragOver {
    border-color: var(--primaryColor);
    border-style: solid;
    background: color-mix(in srgb, var(--primaryColor) 10%, var(--bgColor));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primaryColor) 35%, transparent);
    transform: scale(1.01);
}

/* Behind the buttons, but ahead of the full-width inputs */
#accountDialog .uploadFileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    min-width: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.uploadEmpty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.uploadDropIcon {
    width: 1.65rem;
    height: 1.65rem;
    fill: none;
    stroke: var(--mehColor);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s, transform 0.2s;
}

.uploadDropzone.dragOver .uploadDropIcon {
    stroke: var(--primaryColor);
    transform: translateY(-2px);
}

.uploadPickRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

#accountDialog .uploadChooseBtn {
    background: color-mix(in srgb, var(--primaryColor) 12%, transparent);
    border-color: var(--primaryColor);
}

.uploadInfoTip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* The label's own line height, so the row isn't taller than the other labels */
    width: 1rem;
    height: 1rem;
    /* A filled dot with the ? cut out of it in the dialog's color */
    border-radius: 50%;
    background: var(--mehColor);
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1;
    color: var(--panelColor);
    cursor: help;
    transition: background-color var(--colorFade);
    /* A tap, not the start of a text selection */
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* iPhone Safari only sends a tap on plain text that has a pointer cursor */
@media (hover: none) {
    .infoTip {
        cursor: pointer;
    }
}

@media (hover: hover) {
    .uploadInfoTip:hover, .uploadInfoTip:focus-visible {
        background: var(--primaryColor);
    }
}

.uploadHint {
    margin: 0;
}

.uploadUrlRow {
    display: flex;
    gap: 0.45rem;
    width: 100%;
    align-items: center;
}

.uploadUrlRow .uploadUrlInput {
    flex: 1 1 auto;
    font-size: 0.85rem !important;
    min-height: 38px !important;
    padding: 0.35rem 0.65rem !important;
}

#accountDialog .uploadUrlRow .uploadUrlBtn {
    min-height: 38px;
    padding: 0 0.75rem;
    font-size: 0.85rem;
}

.uploadPreview {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-align: left;
}

.uploadThumb {
    width: 4.25rem;
    height: 4.25rem;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid var(--dimBorderColor);
    background: var(--panelColor);
    flex-shrink: 0;
}

.uploadPreviewMeta {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 auto;
}

.uploadFileName {
    font-size: 0.85rem;
    color: var(--primaryColor);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uploadPreviewActions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

#accountDialog .uploadPreviewActions button {
    min-height: 34px;
    padding: 0.2rem 0.65rem;
    font-size: 0.85rem;
}

/* A wide picture whole, with the 3:2 window the card keeps (account.js showUploadCrop). --cropShare is the
   window's share of the width, --cropAt where it sits from 0 (left) to 1 (right) */
.uploadCrop {
    margin-top: 0.75rem;
}

.uploadCropStrip {
    position: relative;
    width: min(100%, calc(9rem * var(--cropRatio, 2)));
    margin: 0 auto;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}

.uploadCropImage {
    width: 100%;
    height: auto;
    filter: brightness(0.45);
}

.uploadCropWindow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: calc(var(--cropShare, 1) * 100%);
    left: calc(var(--cropAt, 0.5) * (1 - var(--cropShare, 1)) * 100%);
    border: 2px solid var(--primaryColor);
    border-radius: 6px;
    backdrop-filter: brightness(2.2);
    pointer-events: none;
}

/* The whole strip is the slider; dragging anywhere on it moves the window */
#accountDialog .uploadCropRange {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
    z-index: 1;
}

.uploadCropStrip:has(.uploadCropRange:focus-visible) {
    outline: 2px solid var(--primaryColor);
    outline-offset: 2px;
}

.uploadCrop .helpDesc {
    margin-top: 0.4rem;
}

.accountItemDesc {
    margin-top: 0.2rem;
    font-size: 0.8rem;
    color: var(--mehColor);
    opacity: 0.85;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}

#accountDialog button, #accountDialog .accountButtonWide, #reportDialog button, #reportDialog .accountButtonWide {
    font: inherit;
    font-size: 0.95rem;
    color: var(--primaryColor);
    background: transparent;
    border: 2px solid var(--borderColor);
    /* Corners at 30% of the height */
    border-radius: 13px;
    padding: 0.5rem 0.9rem;
    min-height: 44px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color var(--colorFade), background-color var(--colorFade), color var(--colorFade);
}

#accountDialog .accountButtonWide, #reportDialog .accountButtonWide {
    display: block;
    box-sizing: border-box;
    width: 100%;
    text-align: center;
    margin: 0.25rem 0 0.6rem;
    line-height: 1.6;
}

/* The main button in a step (Upload, Send report, Save): filled in the dim color, lit on hover or a tap */
#accountDialog .primary, #reportDialog .primary {
    background: var(--mehColor);
    color: var(--panelColor);
    border-color: var(--mehColor);
}

#accountDialog .danger {
    color: #ff5a5a;
    border-color: #ff5a5a;
}

#accountDialog .accountLink {
    border: 0;
    padding: 0;
    min-height: 0;
    text-decoration: underline;
    color: var(--primaryColor);
}

/* Dialog links dim on hover and tap */
#accountDialog .accountLink, .guide .helpDesc a {
    transition: color var(--colorFade);
}

#accountDialog .accountLink.pressed, .guide .helpDesc a.pressed {
    color: var(--mehColor);
    transition: none;
}

@media (hover: hover) {
    #accountDialog .accountLink:hover, .guide .helpDesc a:hover {
        color: var(--mehColor);
    }
}

/* Links in the dialog that read like a card's title: the theme color, no underline, dimming on hover */
#accountDialog .titleLink {
    color: var(--primaryColor);
    text-decoration: none;
    cursor: pointer;
    transition: color var(--colorFade);
}

#accountDialog .accountBack {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 0;
    padding: 0;
    min-height: 0;
}

.accountBackIcon {
    width: 0.9em;
    height: 0.9em;
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (hover: hover) {
    #accountDialog .titleLink:hover {
        color: var(--mehColor);
    }
}

/* A tap dims it a moment, alongside the press bounce (the bounce needs a box, not a line of text) */
#accountDialog .titleLink.pressed {
    color: var(--mehColor);
    transition: none;
}

#accountDialog .accountItemName {
    display: inline-block;
    align-self: flex-start;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Passkey buttons (log in, sign up, add one): filled in the dim color, alike in every step */
#accountDialog .passkeyButton {
    color: var(--panelColor);
    background: var(--mehColor);
    border-color: var(--mehColor);
}

/* Sign up's ways to continue span the dialog, as log in's button does (sharing it when email is on) */
#accountDialog form[data-action="signupStart"] .accountRow > button {
    flex: 1 1 0;
}

/* A dialog button tapped flashes the hover's fill (input.js adds .pressed) */
#accountDialog button.pressed:not(.accountLink, .accountBack, .titleLink), #accountDialog .accountButtonWide.pressed,
#reportDialog button.pressed {
    background: var(--primaryColor);
    border-color: var(--primaryColor);
    color: var(--panelColor);
    transition: none;
}

#accountDialog button.danger.pressed {
    background: #ff5a5a;
    border-color: #ff5a5a;
    color: var(--panelColor);
}

/* A dialog button hovered fills with its border's color, its text in the panel color */
@media (hover: hover) {
    .guideClose:hover,
    #accountDialog button:not(.accountLink, .accountBack):hover, #accountDialog .accountButtonWide:hover,
    #reportDialog button:hover, #reportDialog .accountButtonWide:hover {
        background: var(--primaryColor);
        border-color: var(--primaryColor);
        color: var(--panelColor);
    }

    #accountDialog button.danger:not(.accountLink, .accountBack):hover {
        background: #ff5a5a;
        border-color: #ff5a5a;
        color: var(--panelColor);
    }
}

.accountDivider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--mehColor);
    font-size: 0.85rem;
    margin: 0.75rem 0;
}

.accountDivider::before, .accountDivider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--dimBorderColor);
}

.accountItem {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--dimBorderColor);
}

.accountItemMain {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.accountItemActions {
    display: flex;
    gap: 0.4rem;
}

.accountItem > form, .accountItem > .confirmRow {
    flex-basis: 100%;
}

/* A question that slides open under what it's about: Cancel or go ahead */
.confirmRow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.confirmRow > span {
    flex: 1 1 100%;
}

.confirmRow input {
    flex: 1 1 10rem;
}

.accountNudge {
    border-left: 2px solid var(--primaryColor);
    padding-left: 0.75rem;
}

.accountStatus {
    min-height: 1.3em;
    margin: 0.5rem 0 0;
    color: var(--mehColor);
    font-size: 0.9rem;
    text-align: center;
}

.accountStatus.error {
    color: #ff5a5a;
}

.helpDesc.small {
    font-size: 0.8rem;
}

/* Page changes to and from the admin console: the logo holds its place while the rest crossfades */
@view-transition {
    navigation: auto;
}

#logo {
    view-transition-name: logo;
}

#accountDialog [hidden] {
    display: none !important;
}

/* Fields as tall as the buttons beside them; no empty status line or trailing gap above Close */
#accountDialog input {
    min-height: 44px;
}

.accountStatus:empty {
    min-height: 0;
    margin: 0;
}

#accountDialog .helpSection:last-child {
    margin-bottom: 0;
}

#accountDialog .accountRow button, #accountDialog .confirmRow button {
    padding-top: 0;
    padding-bottom: 0;
}

#accountDialog button, #reportDialog button {
    box-sizing: border-box;
}

#accountDialog .accountRow, #accountDialog .confirmRow {
    align-items: center;
}

#accountDialog .accountRow > input, #accountDialog .accountRow > button,
#accountDialog .confirmRow > input, #accountDialog .confirmRow > button {
    height: 44px;
}

/* Close is a real button (keyboard and screen readers), drawn like the help dialog's */
button.guideClose {
    font: inherit;
    font-size: 0.95rem;
}

#accountDialog .guideHeading:focus {
    outline: none;
}

/* The row that ends a list (log out everywhere) has no line under it */
.accountItem.lastItem {
    border-bottom: 0;
}

/* Held on a touch screen, a button shows its tooltip instead of the system's callout or a selection */
[data-tip] {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* An upload's state below its username, for its owner (private, in review, rejected) */
.cardAuthorGroup {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
}

.pieceTag {
    margin: 0.25rem 0 0 0;
    padding: 0 0.35em;
    border: 1px solid var(--mehColor);
    border-radius: 4px;
    font-size: 0.75em;
    line-height: 1.3;
    color: var(--mehColor);
}

/* Upload description on the card: hidden until the bookmark tray opens, clamped to 4 lines */
.cardDescWrap {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    transform: translateY(-0.25rem);
    transition: max-height 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease-out,
        margin-top 0.28s cubic-bezier(0.22, 1, 0.36, 1), transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

/* The gap between the title and the description (the page script reads it too) */
.content {
    --descGap: 0.4rem;
}

.content.descOpen .cardDescWrap {
    opacity: 1;
    margin-top: var(--descGap);
    transform: none;
}

.cardDesc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-clamp: 4;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 0.85rem;
    line-height: 1.3rem;
    color: var(--mehColor);
    text-align: left;
}

/* Views: small, in the card's bottom right corner, hidden until the bookmark tray opens. It rises and fades in
   on the description's curve and drops away quicker as the tray closes (tray.js sets .viewsOpen) */
/* No height of its own at the card's end, so nothing moves; the count hangs from it into the bottom padding */
.cardViews {
    position: relative;
    height: 0;
    pointer-events: none;
    opacity: 0;
    transform: translateY(0.3rem);
    transition: opacity 0.15s ease-in, transform 0.2s ease-in;
}

.cardViews .viewsInner {
    position: absolute;
    right: 0;
    top: -0.15rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.6rem;
    line-height: 1;
    color: var(--mehColor);
    font-variant-numeric: tabular-nums;
}

.cardViews .eyeIcon {
    width: 0.75rem;
    height: 0.75rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.content.viewsOpen .cardViews {
    opacity: 1;
    transform: none;
    transition: opacity 0.22s ease-out 0.08s, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

/* The eye blinks once as the count comes in */
.content.viewsOpen .cardViews .eyeIcon {
    transform-origin: center;
    animation: eyeBlink 0.3s ease-in-out 0.32s;
}

@keyframes eyeBlink {
    0%, 100% { transform: scaleY(1); }
    40%, 55% { transform: scaleY(0.1); }
}

@media (prefers-reduced-motion: reduce) {
    .content.viewsOpen .cardViews .eyeIcon {
        animation: none;
    }
}

/* Report reasons as radio buttons, one per line */
.reportReason {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.45rem 0;
    color: var(--mehColor);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color var(--colorFade);
}

#reportDialog .reportReason input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    flex: 0 0 auto;
    display: grid;
    place-content: center;
    width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    padding: 0;
    border: 2px solid var(--borderColor);
    border-radius: 50%;
    background: var(--bgColor);
    -webkit-background-clip: border-box;
    background-clip: border-box;
    cursor: pointer;
    transition: border-color var(--colorFade);
}

/* The dot: grows in when picked */
#reportDialog .reportReason input[type="radio"]::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--primaryColor);
    transform: scale(0);
    transition: transform 0.2s var(--springBouncy);
}

#reportDialog .reportReason input[type="radio"]:checked {
    border-color: var(--primaryColor);
}

#reportDialog .reportReason input[type="radio"]:checked::before {
    transform: scale(1);
}

#reportDialog .reportReason:has(input:checked) {
    color: var(--primaryColor);
}

#reportDialog .reportReason input[type="radio"]:focus-visible {
    outline: 2px solid var(--primaryColor);
    outline-offset: 2px;
}

@media (hover: hover) {
    #reportDialog .reportReason:hover {
        color: var(--primaryColor);
    }

    #reportDialog .reportReason:hover input[type="radio"] {
        border-color: var(--primaryColor);
    }
}

/* Collections (saved cards, your uploads) as a list or tiles. The page script switches them and remembers which */
.collectionBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.viewToggle {
    display: flex;
    gap: 0.25rem;
}

#accountDialog .viewButton {
    /* Flex with a block icon: Safari set the icon off center in a grid */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border: 0;
    /* Corners at 30% of the height */
    border-radius: 10px;
    color: var(--mehColor);
    background: transparent;
}

#accountDialog .viewButton.on {
    color: var(--primaryColor);
    background: color-mix(in srgb, var(--primaryColor) 14%, transparent);
}

.viewButton svg {
    display: block;
    flex: none;
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* The list shows no art */
.collectionThumb {
    display: none;
}

/* Tiles in a grid, all one size */
.collection.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr));
    gap: 0.6rem;
    padding-top: 0.25rem;
}

/* A tile: the art in a frame over its title and source, all in the tile's frame. Row actions stay in the list.
   Its width sizes the art frame's square (100cqw below) */
.collection.tiles .collectionItem {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.45rem;
    border: 1.5px solid var(--borderColor);
    border-radius: 12px;
    transition: border-color var(--colorFade);
}

/* In chroma, a tile is in its own card's colors (lib/palette.js tilePalette, from the card's accent as the page
   makes chroma's palette): its title, source, borders, frame and panel */
.collection.tiles .collectionItem[style] {
    --primaryColor: var(--tilePrimary);
    --mehColor: var(--tileMeh);
    --borderColor: var(--tileBorder);
    --bgColor: var(--tileBg);
    --panelColor: var(--tilePanel);
    --dimBorderColor: color-mix(in srgb, var(--borderColor) 55%, var(--panelColor));
    background: var(--panelColor);
}

/* Each part at its own size */
.collection.tiles .collectionItem > * {
    flex-shrink: 0;
}

/* No link tap padding in tiles, it pulled the art over the top edge */
#accountDialog .collection.tiles .collectionThumb, #accountDialog .collection.tiles .accountItemName {
    margin: 0;
    padding: 0;
}

.collection.tiles .collectionThumb {
    /* A square: its width sizes the art (below). Tall art is cropped evenly above and below; wide art comes with
       filler from its own characters to fill it (lib/saved.js tileArt) */
    container-type: inline-size;
    display: block;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    padding: 0.3rem;
    border: 1.5px solid var(--dimBorderColor);
    border-radius: 8px;
    background: var(--bgColor);
    text-decoration: none;
    transition: border-color var(--colorFade);
}

/* 48 characters wide (lib/saved.js asciiThumb), sized to fill the frame's width. Rows are a set share of the
   width (1.3 of the font), not of the font's own metrics, so TILE_ROWS always covers the square; and the art is
   centered by position, not grid alignment (iPhone Safari held a short art to the top, leaving a gap below) */
#accountDialog .collectionThumb pre {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    font-family: 'Cascadia Mono', monospace;
    font-size: calc(100cqw / 48 / 0.586);
    line-height: calc(100cqw / 48 / 0.586 * 1.3);
    color: var(--primaryColor);
    white-space: pre;
}

/* Chroma tiles: each line's gradient shows through its characters, as on the cards (.ASCII.chroma) */
#accountDialog .collectionThumb pre.chroma, #accountDialog .collectionThumb pre.chroma span[style] {
    color: transparent;
}

#accountDialog .collectionThumb pre.chroma span[style] {
    -webkit-background-clip: text;
    background-clip: text;
}

/* Chroma tiles show as a canvas the page script draws once (account.js drawChromaTile), not as live text: the
   text is never painted, before or after */
#accountDialog .collectionThumb pre.chroma {
    visibility: hidden;
}

#accountDialog .collectionThumb.tileDrawn pre.chroma {
    display: none;
}

/* Over the frame inside its border; the script sets its size and nudges it onto the screen's pixel grid */
#accountDialog .collectionThumb canvas.tileCanvas {
    position: absolute;
    display: block;
}

/* The filler that squares a wide tile, dimmed so the art stands out */
#accountDialog .collectionThumb .tileFill {
    opacity: 0.3;
}

/* A blocked person's favorite: the no-entry sign with AUTHOR BLOCKED across it */
#accountDialog .blockedThumb pre {
    color: var(--mehColor);
}

.collection.tiles .accountItemMain {
    width: 100%;
    min-width: 0;
}

/* One line each, cut short (under the dialog's id, which its own title rule uses) */
/* Smaller than the list's: a tile's title and source under its art */
#accountDialog .collection.tiles .accountItemName {
    font-size: 0.8rem;
}

#accountDialog .collection.tiles .accountItemMain .helpDesc {
    font-size: 0.68rem;
}

#accountDialog .collection.tiles .accountItemName, #accountDialog .collection.tiles .accountItemMain .helpDesc {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: normal;
}

/* A list's row buttons, smaller than the dialog's own (corners still the menu items' to scale) */
#accountDialog .collection:not(.tiles) .accountItemActions button {
    min-height: 0;
    height: 2rem;
    padding: 0 0.7rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

.collection.tiles .accountItemActions, .collection.tiles .accountItemDesc, .collection.tiles form,
.collection.tiles .confirmRow {
    display: none !important;
}

@media (hover: hover) {
    .collection.tiles .collectionItem:hover, .collection.tiles .collectionItem:hover .collectionThumb {
        border-color: var(--primaryColor);
    }
}

/* The Upload button while it works: the theme color fills it as the picture goes up, then moving stripes
   while the server makes the art (account.js showUploadProgress) */
#accountDialog .accountButtonWide.uploading {
    pointer-events: none;
    color: var(--panelColor);
    border-color: var(--primaryColor);
    background: linear-gradient(to right, var(--primaryColor) var(--progress, 0%), var(--mehColor) var(--progress, 0%));
    font-weight: bold;
}

#accountDialog .accountButtonWide.converting {
    background: repeating-linear-gradient(-45deg, var(--primaryColor) 0 12px,
        color-mix(in srgb, var(--primaryColor) 65%, var(--panelColor)) 12px 24px);
    background-size: 34px 34px;
    animation: uploadStripes 0.7s linear infinite;
}

@keyframes uploadStripes {
    to { background-position: 34px 0; }
}

@media (prefers-reduced-motion: reduce) {
    #accountDialog .accountButtonWide.converting {
        animation: none;
    }
}

/* Upload your art: more room between the picture, its title and its description */
#accountDialog .artUpload > .accountLabel {
    margin-bottom: 1.1rem;
}

/* No rubber-band stretch on the main screen */
html, body {
    overscroll-behavior: none;
}

/* Favorites list: one line each, Remove at the right */
#accountDialog .collection[data-collection="saved"]:not(.tiles) .collectionItem {
    flex-wrap: nowrap;
}

#accountDialog .collection[data-collection="saved"]:not(.tiles) .accountItemMain {
    flex: 1 1 auto;
    min-width: 0;
}

#accountDialog .collection[data-collection="saved"]:not(.tiles) .accountItemName,
#accountDialog .collection[data-collection="saved"]:not(.tiles) .accountItemMain .helpDesc {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow-wrap: normal;
}

#accountDialog .collection[data-collection="saved"]:not(.tiles) .accountItemActions {
    flex: 0 0 auto;
}

/* Clips the links' tap padding, which added a scrollbar past the last row */
#accountDialog .collection {
    overflow: clip;
    overflow-clip-margin: 0.5rem;
}

/* Phones: the description closer under the title */
@media only screen and (max-width: 600px) and (orientation: portrait), only screen and (min-resolution: 200dpi) and (orientation: portrait) {
    .content {
        --descGap: 0.3rem;
    }
}

/* Report kind dropdown, styled like the dialog's fields */
.reportKind {
    position: relative;
}

#reportDialog .reportKindSelect {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.5rem 2.4rem 0.5rem 0.75rem;
    font: inherit;
    font-size: 16px;
    color: var(--primaryColor);
    background: var(--bgColor);
    border: 2px solid var(--borderColor);
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--colorFade);
}

#reportDialog .reportKindSelect:focus {
    border-color: var(--primaryColor);
}

.reportKind::after {
    content: '';
    position: absolute;
    right: 1rem;
    bottom: 1.1rem;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--mehColor);
    border-bottom: 2px solid var(--mehColor);
    transform: rotate(45deg);
    pointer-events: none;
}

@media (hover: hover) {
    #reportDialog .reportKindSelect:hover {
        border-color: var(--primaryColor);
    }
}

/* Report dialog: spaced like Upload art */
#reportDialog .reportKind, #reportDialog .reportForm > .accountLabel {
    margin-bottom: 1.1rem;
}

#reportDialog .reportForm > .reportReason + .accountLabel {
    margin-top: 1.1rem;
}

#reportDialog [data-pane] > .helpDesc {
    margin-bottom: 0.9rem;
}

/* The flip (flip.js): the whole card turns in 3D, with the original picture and the same title and author on
   its back. The card's own frame and panel show on both sides */
#gallery .content.flipping, #gallery .content.flipped {
    position: relative;
    transform-style: preserve-3d;
}

/* A card that has turned keeps no fade-in: even finished, it flattens the card and both sides would show */
#gallery .content.flipReady {
    animation: none !important;
}

#gallery .content.flipping > :not(.flipBack), #gallery .content.flipped > :not(.flipBack) {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Landed on its back, the card lies flat: the front hidden and the back unturned, so the back scrolls and takes
   swipes exactly as the front does (phones handle neither well inside a 3D turn) */
#gallery .content.flipped:not(.flipping) {
    transform-style: flat;
}

#gallery .content.flipped:not(.flipping) > :not(.flipBack) {
    visibility: hidden;
}

#gallery .content.flipped:not(.flipping) > .flipBack {
    transform: none;
}

/* The scan beam stays off while the card is turned */
#gallery .content.flipping .asciiWrapper::before, #gallery .content.flipped .asciiWrapper::before {
    visibility: hidden;
}

/* Laid out like the card's front: its padding, the picture where the art is, the title and author and the
   description under it */
.flipBack {
    display: none;
    position: absolute;
    inset: 0;
    flex-direction: column;
    padding: inherit;
    transform: rotateX(180deg) translateZ(1px);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.content.flipping .flipBack, .content.flipped .flipBack {
    display: flex;
}

/* The picture fills the width as the art does and scrolls the same way when it's taller (its scrollbar on the
   card's border like the art's); a shorter one sits in the middle. The box runs 30px past the art for the
   scrollbar and the picture keeps the art's width, so a desktop scrollbar doesn't push it off center */
.flipPicture {
    position: relative;
    flex: none;
    display: flex;
    flex-direction: column;
    width: calc(var(--asciiWidth) + 30px);
    overflow-x: hidden;
    overflow-y: auto;
}

.flipPicture img {
    display: block;
    flex-shrink: 0;
    width: var(--asciiWidth);
    height: auto;
    margin: auto 0;
    opacity: 0;
}

/* The same frame on the back, over the art's box (the picture's own box runs past it for the scrollbar):
   pulled up over the picture by its own height, so it takes no room either and stays put while it scrolls */
.flipFrame {
    flex: none;
    position: relative;
    width: var(--asciiWidth);
    height: var(--artHeight, 0px);
    margin-top: calc(-1 * var(--artHeight, 0px));
    outline: 2px solid var(--dimBorderColor);
    border-radius: 6px;
    pointer-events: none;
}

/* Beside art that fits its box, the picture fits too, whole and in the middle, with no scroll (flip.js) */
.flipPicture.fit {
    overflow: hidden;
}

.flipPicture.fit img {
    height: 100%;
    margin: 0;
    object-fit: contain;
}

.flipPicture.missing {
    width: var(--asciiWidth);
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flipPicture.drawn img {
    animation: 0.25s ease-out forwards fadeIn;
}

.flipPicture.missing img {
    display: none;
}

.flipBack .cardDescWrap {
    overflow: hidden;
}

/* The back is empty until the picture starts drawing; then its title and author fade in with it */
.flipBack .cardInfo, .flipBack .cardDescWrap {
    opacity: 0;
    transition: opacity 0.25s ease-out;
}

.flipBack.ready .cardInfo, .flipBack.ready .cardDescWrap {
    opacity: 1;
}

.flipMissing {
    white-space: pre;
    line-height: 1.3;
    color: var(--primaryColor);
}

/* A list's last row has the same room under it as Your devices' rows (the row padding, then 0.5rem) before what follows */
#accountDialog .accountItem + .accountButtonWide {
    margin-top: 0.5rem;
}

/* Just uploaded: the same row, its buttons on a line of their own under the title and status, no description */
#accountDialog .uploadJustSection {
    padding-bottom: 0.25rem;
}

#accountDialog .uploadJustSection .accountItemActions {
    flex-basis: 100%;
}

#accountDialog .uploadJustSection .accountItemDesc {
    display: none;
}

/* The terms and the privacy notice, a page on from the dialog they're linked from (guides.js openLegal); only
   the one asked for shows, laid out as the dialog's own heading and text */
#legalDialogWrapper {
    z-index: 100;
}

/* A page on from another dialog: that dialog's backdrop is already behind it */
#legalDialogWrapper.pushed {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: transparent;
}

#legalDialog .legalDoc:not([hidden]) {
    display: contents;
}

#legalDialog .helpDesc + .helpDesc {
    margin-top: 0.6rem;
}

/* Premium camera (premium/src/camera.js) */
/* Behind the camera, the page's background color instead of the blur: the main screen stops drawing under it
   (body.cameraFocus) and the feed's color shows through the whole palette */
#cameraDialogWrapper { background: var(--bgColor); -webkit-backdrop-filter: none; backdrop-filter: none; }
body.cameraFocus #appWrapper { visibility: hidden; }
:is(#cameraDialog, #convertDialog) .cameraText { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
:is(#cameraDialog, #convertDialog) .cameraLiveView:not([hidden]), :is(#cameraDialog, #convertDialog) .cameraResult:not([hidden]) { display: flex; flex-direction: column; align-items: stretch; gap: 0.75rem; width: 100%; }
:is(#cameraDialog, #convertDialog) .guideClose { margin-top: 0.75rem; }
:is(#cameraDialog, #convertDialog) .cameraLive, :is(#cameraDialog, #convertDialog) .cameraPreview > * { display: block; width: 100%; max-width: 100%; box-sizing: border-box; max-height: 60vh; object-fit: contain; background: var(--panelColor); }
:is(#cameraDialog, #convertDialog) .cameraMessage { margin: 0; text-align: center; }
:is(#cameraDialog, #convertDialog) .cameraMessage:empty { display: none; }
:is(#cameraDialog, #convertDialog) .cameraControls { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0; }
/* The dialogs' standard buttons (#accountDialog's): outlined in the border color, corners at 30% of the height */
:is(#cameraDialog, #convertDialog) .cameraControls button { font: inherit; font-size: 0.95rem; color: var(--primaryColor); background: transparent; border: 2px solid var(--borderColor); border-radius: 13px; padding: 0.5rem 0.9rem; min-height: 44px; cursor: pointer; white-space: nowrap; transition: border-color var(--colorFade), background-color var(--colorFade), color var(--colorFade); }
:is(#cameraDialog, #convertDialog) .cameraControls button.primary { background: var(--mehColor); color: var(--panelColor); border-color: var(--mehColor); }
@media (hover: hover) {
    :is(#cameraDialog, #convertDialog) .cameraControls button:hover { background: var(--primaryColor); border-color: var(--primaryColor); color: var(--panelColor); }
}
/* The buttons are icons (their names in tooltips): square, the icon centered */
:is(#cameraDialog, #convertDialog) .cameraControls button[data-tip] { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; padding: 0.5rem 0.9rem; }
:is(#cameraDialog, #convertDialog) .cameraIcon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:is(#cameraDialog, #convertDialog) .cameraIcon .iconFill { fill: currentColor; stroke: none; }
/* Record (a film camera), or a stop square while recording (camera.js showRecording) */
:is(#cameraDialog, #convertDialog) [data-camera="record"].recording .recIcon, :is(#cameraDialog, #convertDialog) [data-camera="record"]:not(.recording) .stopIcon { display: none; }
/* No camera: dimmed like the shuffle button while it waits */
:is(#cameraDialog, #convertDialog) .cameraControls button:disabled { opacity: 0.3; cursor: default; pointer-events: none; }
:is(#cameraDialog, #convertDialog) [hidden] { display: none !important; }
:is(#cameraDialog, #convertDialog) .cameraStage { position: relative; isolation: isolate; --scanOver: 0px; }
/* The art's frame, as a card's (.asciiWrapper): an outline, drawn over the scan beam */
:is(#cameraDialog, #convertDialog) .cameraStage, :is(#cameraDialog, #convertDialog) .cameraPreview > * { outline: 2px solid var(--dimBorderColor); border-radius: 6px; }
:is(#cameraDialog, #convertDialog) .cameraLive { border-radius: 6px; }
:is(#cameraDialog, #convertDialog) .cameraTimer { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 3; margin: 0; padding: 2px 10px; border-radius: 13px; font-variant-numeric: tabular-nums; color: var(--panelColor); background: var(--primaryColor); }
@media (prefers-reduced-motion: no-preference) {
    :is(#cameraDialog, #convertDialog) .cameraStage.beamIn::before { content: ''; position: absolute; z-index: 1; inset: 0; background: var(--panelColor); transform-origin: bottom; transform: scaleY(0); pointer-events: none; animation: 0.7s cubic-bezier(0.3, 0, 0.25, 1) backwards asciiScan; }
    :is(#cameraDialog, #convertDialog) .cameraStage.beamIn::after { content: ''; position: absolute; z-index: 2; left: 0; right: 0; height: 2px; opacity: 0; background: var(--primaryColor); box-shadow: 0 0 10px 2px var(--primaryColor); pointer-events: none; animation: 0.7s cubic-bezier(0.3, 0, 0.25, 1) backwards asciiBeam; }
}
#paywallDialog .paywallFeatures { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#paywallDialog .paywallFeatures b { display: block; color: var(--primaryColor); }
#paywallDialog .paywallTrial { margin: 0 0 8px; text-align: center; color: var(--primaryColor); }
#paywallDialog .paywallPlans { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#paywallDialog .paywallPlan { font: inherit; color: var(--primaryColor); background: transparent; border: 1px solid var(--primaryColor); border-radius: 8px; padding: 10px 16px; cursor: pointer; }
#paywallDialog .paywallPlan.primary { background: var(--primaryColor); color: #090f10; }
#paywallDialog .paywallMessage:empty { display: none; }
#paywallDialog .paywallSmall { font-size: 0.85em; text-align: center; margin-top: 12px; }

/* Help and Commands: one key column through the whole dialog, as wide as its widest key (at least the usual
   5.5rem), so long keys like /unblock @user never run into their descriptions and the descriptions line up */
@supports (grid-template-columns: subgrid) {
    #helpText, #promptHelpText {
        display: grid;
        grid-template-columns: minmax(5.5rem, max-content) 1fr;
        column-gap: 1rem;
        align-content: start;
    }

    #helpText > *, #promptHelpText > *, #helpText .helpSection > *, #promptHelpText .helpSection > * {
        grid-column: 1 / -1;
    }

    #helpText .helpSection, #promptHelpText .helpSection, #helpText .helpRow, #promptHelpText .helpRow {
        display: grid;
        grid-template-columns: subgrid;
    }

    @media only screen and (max-width: 600px) and (orientation: portrait), only screen and (min-resolution: 200dpi) and (orientation: portrait) {
        #helpText, #promptHelpText {
            grid-template-columns: minmax(4.75rem, max-content) 1fr;
            column-gap: 0.75rem;
        }
    }
}

/* Under the upload drop zone: converting without uploading (account.js openConvert) */
#accountDialog .uploadConvertRow {
    margin-top: 0.5rem;
    text-align: center;
}
