:root {
    --bg: #fdfdfc;
    --panel: #ffffff;
    --ink: #1b1b1a;
    --muted: #6a6a66;
    --line: #e2e1dd;
    --accent: #7a4b2a;
    --brand-from: #a2521f;
    --brand-mid: #d0762f;
    --brand-to: #c2452f;
    /* Secondary accent. Orange marks the dictionary layer — words, senses,
       links out. Teal marks the grammar layer we generate ourselves. */
    --accent-2: #1f6f63;
    /* The wordmark's gradient again, this time as a fill with text on top of
       it. The middle stop is darkened because that is where the gradient is
       lightest: #d0762f under white reads at 3.3:1, which is below AA, and
       this reads at 4.6:1 without changing the gradient's character. */
    --brand-fill-mid: #b35f22;
    --on-brand: #ffffff;
    /* The reading gradient, in the teal that marks the grammar layer rather
       than in the brand orange: Read and Learn are two doors and should not
       look like the same one. Every stop clears AA against white — the
       lightest, #1c7a63, reads at 5.2:1 — because the middle of a gradient is
       where contrast quietly fails. */
    --read-from: #14625c;
    --read-mid: #1c7a63;
    --read-to: #196b7d;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #17171a;
        --panel: #1f1f23;
        --ink: #eceae6;
        --muted: #9b9a95;
        --line: #33333a;
        --accent: #d9a273;
        --brand-from: #d9a273;
        --brand-mid: #f2c79c;
        --brand-to: #ef9b74;
        --accent-2: #6ec3b2;
        /* The dark palette's brand colours are the light ones, so the fill
           needs no darkening and the text on it flips to ink. */
        --brand-fill-mid: #f2c79c;
        --on-brand: #17171a;
        /* Light on dark here, with ink over it, so the stops go up rather than
           down: 8.6:1 at the darkest. */
        --read-from: #6ec3b2;
        --read-mid: #93dccb;
        --read-to: #7fc6d8;
    }
}

* { box-sizing: border-box; }

/* Safari enlarges text in landscape unless told not to, which turns a laid out
   page into a different one on a turn of the wrist. */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    /* The platform's own is an opaque grey block over whatever was tapped —
       on a word in a sentence that reads as a glitch. Neutral in both
       themes, because it sits over panels and over the page alike. */
    -webkit-tap-highlight-color: rgb(127 127 127 / .2);
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

.wrap {
    max-width: 46rem;
    margin: 0 auto;
    /* A notch in landscape eats the gutter on one side. env() is 0 wherever
       there is not one, so this is the plain 1rem on every other device. */
    padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
}

/* Prose reads at 46rem; a grid of tiles does not. */
.wrap-wide { max-width: 64rem; }

header.site {
    border-bottom: 1px solid var(--line);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

/* Wider than the reading column. 46rem is right for prose and wrong for a bar
   of controls: the brand, the tagline, a language, three links and an account
   were being folded into 736px on a 1500px screen, which is what made the
   tagline and the reader's own name wrap onto two lines. */
header.site .wrap {
    display: flex;
    align-items: center;
    gap: .75rem;
    max-width: 68rem;
    /* The drawer below 46rem hangs off this, and the hidden checkbox that
       opens it is parked in the corner. */
    position: relative;
}

/* Nothing in a navigation bar should wrap: a name that breaks over two lines
   makes the bar taller than the row it belongs to. The drawer's own children
   are named too — `display: contents` makes them the bar's flex items, which
   a child selector on the wrap does not reach. */
header.site .wrap > *,
header.site .nav-items > * { flex: none; }

/* …except the tagline, which is the one thing here that may give ground. Left
   at `none` with everything else it cannot shrink, so the bar overflows instead
   of the sentence getting shorter. */
header.site .tagline { flex: 0 1 auto; }
header.site .tagline,
.account,
.account a,
.help-link,
.learn-cta { white-space: nowrap; }

/* It may shrink before anything else does — it is the only decoration here. */
header.site .tagline { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

header.site a.brand {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    text-decoration: none;
    color: var(--ink);
}

.brand-mark { display: block; width: 30px; height: 30px; border-radius: .45rem; }

.brand-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }

/* The gradient rides on the text itself. The solid accent below is the fallback
   for anything that cannot clip a background to glyphs. */
.gradient { color: var(--accent); }

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .gradient {
        background: linear-gradient(100deg, var(--brand-from), var(--brand-mid) 55%, var(--brand-to));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}

header.site .tagline { color: var(--muted); font-size: .85rem; }

/* Sits at the end of the header; the Learn button ahead of it is what pushes
   the whole group there. */
.account { display: inline-flex; align-items: center; gap: .5rem; font-size: .85rem; }
.account a { color: var(--muted); text-decoration: none; }
.account a:hover { color: var(--accent); }
.account-name { color: var(--ink); }
.account-avatar { border-radius: 50%; }

/* The help link stops being the last thing in the header once an account
   corner is there, so the push to the end moves to the account. */
.help-link { font-size: .85rem; color: var(--muted); text-decoration: none; }
.help-link:hover { color: var(--accent); }

/* Reading a whole work. Set wider and looser than the rest of the site: this is
   the one page somebody stays on for an hour. */
.work-head { margin-bottom: 1.2rem; }

.work-author { margin: 0 0 .1rem; font-size: .9rem; color: var(--muted); }
.work-author a { color: var(--muted); text-decoration: none; }
.work-author a:hover { color: var(--accent); }

.reading {
    margin: 1.4rem 0;
    font-size: 1.05rem;
    line-height: 1.85;
}

.passage { margin: 0 0 .9rem; }

/* A verse line is its own line: the breaks are the poem, not typography. */
.passage-verse { margin-bottom: .1rem; }

/* A word is a button and must not look like one: the page is a page of Latin,
   and a row of controls is not readable. The affordance is the underline that
   appears when the text is hovered, the same hint the analysis uses. */
.word {
    padding: 0;
    border: 0;
    border-bottom: 1px solid transparent;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.reading:hover .word { border-bottom-color: var(--line); }
.word:hover { border-bottom-color: var(--accent); color: var(--accent); }

.mark { color: var(--muted); }

/* The word being read about, and the rest of its verb phrase: `divisa est` is
   one form and lights up as one. */
.word-open { border-bottom-color: var(--accent) !important; color: var(--accent); }
.word-kin { border-bottom-color: var(--accent-2) !important; color: var(--accent-2); }

/* Fixed to the window rather than sticky in the flow. Sticky holds an element
   only while its own place on the page is in view, and this one's place is the
   end of a long text — so clicking a word in the first paragraph opened a panel
   the reader could not see. Fixed also means the paragraph never moves under
   somebody reading it. */
.word-panel {
    position: fixed;
    left: 50%;
    bottom: max(1.2rem, env(safe-area-inset-bottom));
    z-index: 30;
    width: min(44rem, calc(100% - 2rem));
    /* A proper noun with six senses is taller than a phone. Scroll inside the
       panel rather than off the top of it, and never take more than half the
       window — the sentence the word came from has to stay readable, which is
       the whole reason the panel is a panel and not a page. */
    max-height: 55dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-50%);
    padding: .9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: .6rem;
    background: var(--bg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
}

/* Room for the panel to sit over, so the last line of a text is reachable. */
.reading { padding-bottom: 6rem; }

/* Out of the flow, so a long headword runs under it rather than being pushed
   into a second line by it. */
.panel-close {
    position: absolute;
    top: .45rem;
    right: .55rem;
    padding: 0 .3rem;
    border: 0;
    background: none;
    font-size: 1.15rem;
    line-height: 1.2;
    color: var(--muted);
    cursor: pointer;
}

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

.panel-word { margin: 0; padding-right: 1.4rem; font-size: 1.05rem; font-weight: 600; }
.panel-about { margin: .15rem 0 .5rem; font-size: .85rem; color: var(--accent-2); }
.panel-senses { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.panel-senses li { margin: .12rem 0; }
.panel-none { margin: 0; font-size: .9rem; color: var(--muted); }

/* One block per dictionary entry. A word is often two words — Latin `cum` is a
   preposition and a conjunction, meaning `with` and `when` — and running their
   senses into one list says they are the same word used loosely. */
.panel-entry + .panel-entry { margin-top: .5rem; }

.panel-pos {
    margin: 0 0 .1rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}
.panel-more { margin: .5rem 0 0; font-size: .82rem; }

/* Page turning, at both ends: a reader finishing a page should not scroll back
   up to leave it. */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .6rem 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    font-size: .85rem;
}

.pager-step { text-decoration: none; white-space: nowrap; }
.pager-step:hover { text-decoration: underline; }
.pager-where { color: var(--muted); text-align: center; }
.pager-count { display: block; font-size: .75rem; }

/* Where a produced answer is typed — a cloze, a declension, a dictation. Wide
   enough for a long word and no wider: a box the width of the card invites a
   sentence, and the question is one word. */
.dictation { margin: .9rem 0 .2rem; }

.dictation-box {
    width: min(18rem, 100%);
    padding: .45rem .6rem;
    border: 1px solid var(--line);
    border-radius: .4rem;
    background: var(--panel);
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.dictation-box:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* Scored, so it says so. The box used to be told-not-scored, on the grounds
   that the grade was the reader's — it is not any more, and leaving the mark
   colourless would be hiding what went into the schedule. Accents aside is a
   pass and takes the pass colour: the distinction is in the words underneath,
   where it belongs, rather than in a third colour nobody could read. */
.dictation-pass { border-color: var(--accent-2); }
.dictation-fail { border-color: var(--brand-to); }

.dictation-said { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }
.dictation-said strong { color: var(--ink); }

/* The player sits above the sentence on a dictation card, where the audio is
   the question rather than part of the answer. */
.card-listen-ask { margin: .2rem 0 .7rem; }

/* The two ways to get a deck, side by side: one we wrote, one you write. */
.deck-section-actions { display: flex; gap: .5rem; align-items: center; }

.deck-ready {
    padding: .35rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}

.deck-ready:hover { border-color: var(--accent); color: var(--accent); }

/* A list rather than a grid of tiles: these are being chosen from, not studied,
   and a row is easier to read down than a wall of cards. */
.ready-list {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    max-height: 60dvh;
    overflow-y: auto;
    margin: .6rem 0;
}

.ready-deck {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .2rem;
    border-bottom: 1px solid var(--line);
}

.ready-deck:last-child { border-bottom: 0; }

.ready-name { margin: 0; font-size: .92rem; font-weight: 600; }
.ready-blurb { margin: .1rem 0 0; font-size: .8rem; color: var(--muted); }

.ready-add {
    flex: none;
    padding: .3rem .7rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}

.ready-add:hover { background: var(--accent); color: var(--on-brand); }
.ready-add:disabled { opacity: .5; cursor: default; }

/* What a reader has open, above the shelves. */
.open-books {
    margin: 1.5rem 0 0;
    padding: .9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
}

.open-books .shelf-author { margin-bottom: .3rem; }

/* A language with no library. Boxed like the shelf it stands in for, so the
   page still looks like the library rather than like an error. */
.unread-choices {
    margin: 0 0 1.5rem;
    padding: .9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
}

.unread-title {
    font-size: 1.9rem;
    line-height: 1.25;
    margin: 0 0 .4rem;
    text-wrap: balance;
}

.unread-actions { display: flex; align-items: center; gap: 1rem; margin: 0; }

/* Fifty names, so they have to be dense: a list a reader has to scroll to use
   is not an index. Wraps rather than scrolls sideways, because a hidden name is
   a name nobody finds. */
.author-index {
    display: flex;
    flex-wrap: wrap;
    gap: .2rem .55rem;
    margin: 1.5rem 0 0;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: .55rem;
    font-size: .8rem;
    line-height: 1.5;
}

.author-index a {
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.author-index a:hover { color: var(--accent); text-decoration: underline; }

/* The heading lands clear of the top of the window rather than flush against
   it, so the name the reader jumped to has its works visible under it. */
.shelf { scroll-margin-top: 1.5rem; }

/* The library. Authors as shelves, because a reader looks for an author before
   a title and fifty names are easier to scan than three hundred. */
/* Columns that flow rather than a grid that lines up: one author has thirty
   works and most have one, so a grid puts a tall cell beside a short one and
   leaves a hole. Text flows into the next column instead. */
.library {
    columns: 3 17rem;
    column-gap: 2.4rem;
    margin-top: 2rem;
}

.shelf {
    break-inside: avoid;
    margin: 0 0 1.5rem;
}

.shelf-author {
    margin: 0 0 .4rem;
    font-size: .95rem;
    font-weight: 600;
    color: var(--ink);
}

.shelf-works { margin: 0; padding: 0; list-style: none; }

.shelf-works li {
    padding: .22rem 0;
    font-size: .88rem;
    line-height: 1.35;
}

.shelf-works a { text-decoration: none; }
.shelf-works a:hover { text-decoration: underline; }

/* On its own line under a long title rather than beside it: a title that wraps
   would otherwise leave the count stranded on a line of its own anyway. */
.work-size {
    display: block;
    font-size: .75rem;
    color: var(--muted);
}

/* Which language you are working in. A dropdown rather than a row of them:
   the header already carries a brand, a tagline, three links and an account
   corner, and one more item per language is how a navigation bar stops being
   readable. <details> so it opens with no javascript — the word pages are
   pre-rendered, and a menu that needs a script would not work on them. */
.lang-menu {
    position: relative;
    margin-left: auto;
    font-size: .85rem;
}

.lang-menu > summary {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .5rem;
    border-radius: .4rem;
    color: var(--muted);
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}

/* Safari draws its own triangle through ::-webkit-details-marker. */
.lang-menu > summary::-webkit-details-marker { display: none; }

.lang-menu > summary::after {
    content: '';
    width: .32rem;
    height: .32rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-.1em) rotate(45deg);
}

.lang-menu[open] > summary::after { transform: translateY(.1em) rotate(-135deg); }

.lang-menu > summary:hover,
.lang-menu[open] > summary { color: var(--ink); }

.lang-name { color: var(--ink); }

.lang-options {
    position: absolute;
    right: 0;
    top: calc(100% + .35rem);
    z-index: 20;
    display: flex;
    flex-direction: column;
    min-width: 8rem;
    padding: .25rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: var(--bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}

.lang-option {
    padding: .35rem .5rem;
    border-radius: .35rem;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.lang-option:hover { color: var(--ink); background: rgba(127, 127, 127, .12); }

/* The one already chosen, so the menu says where you are as well as where you
   could go. */
.lang-current { color: var(--ink); font-weight: 600; }

/* The one thing in the header meant to be pressed, so the gradient fills it
   rather than being clipped to the glyphs: everything else on the site uses
   that treatment for emphasis, and a call to action needs to outrank it.
   The push to the end sits on the language menu ahead of it now: two elements
   claiming the free space split it between them, which left the language
   stranded in the middle of the bar with a gap on either side. */
.learn-cta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .01em;
    text-decoration: none;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
    box-shadow: 0 1px 2px rgb(0 0 0 / .18);
}

.learn-cta:hover { filter: brightness(1.06); }
.learn-cta:active { transform: translateY(1px); }
.learn-cta:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* The other door. Same shape as Learn, because they are the two things a reader
   comes here to do and one should not look like a lesser version of the other;
   a different colour, because they are not the same thing. Teal is already what
   marks the grammar this app generates, which is what a reading page is. */
.read-cta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .4rem .9rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: .01em;
    text-decoration: none;
    white-space: nowrap;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--read-from), var(--read-mid) 55%, var(--read-to));
    box-shadow: 0 1px 2px rgb(0 0 0 / .18);
}

.read-cta:hover { filter: brightness(1.06); }
.read-cta:active { transform: translateY(1px); }
.read-cta:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The navigation drawer -------------------------------------------------
   On a laptop the drawer is not a drawer: `display: contents` dissolves it and
   its children become the header's own flex items, which is the bar this site
   has always had. `order` is what that buys — the one item kept out of the
   drawer for the phone's sake, Learn, is last in the markup and belongs in the
   middle of the row, and only flex children can be sequenced.

   Everything in the bar is order 1 upward, so the brand and the tagline keep
   the 0 they have by default and stay at the front without being named. */
.nav-items { display: contents; }
.nav-check,
.nav-toggle { display: none; }

.lang-menu { order: 1; }
.read-cta { order: 2; }
.learn-cta { order: 3; }
.help-link { order: 4; }
.account { order: 5; }

/* The header runs out of room before the page does: the tagline is the part
   that is decoration rather than navigation, so it is what goes. */
@media (max-width: 56rem) {
    /* The first thing to go when the bar is tight: it is the same sentence on
       every page, where everything beside it is a control. */
    header.site .tagline { display: none; }
}

/* Below this the bar is the brand, Learn and a menu. Seven controls do not fit
   across a phone, and the three rows they wrap into are three rows of chrome
   above every page on the site. 46rem rather than something tighter because
   the measured row needs about 36rem and an account name is as long as
   somebody's name: the slack is the point. */
@media (max-width: 46rem) {
    header.site {
        padding: .55rem 0;
        margin-bottom: 1.25rem;
    }

    header.site .wrap { gap: .5rem; }

    /* Focusable and announced, but not seen: the label beside it is what a
       reader presses. Not `display: none`, which would take it out of the tab
       order and leave the menu unreachable from a keyboard. */
    .nav-check {
        position: absolute;
        left: 0;
        top: 0;
        width: 1px;
        height: 1px;
        margin: 0;
        padding: 0;
        opacity: 0;
        pointer-events: none;
    }

    .nav-toggle {
        display: inline-flex;
        order: 4;
        align-items: center;
        justify-content: center;
        /* A 2.5rem box around a 1.1rem mark: the bars are what is seen and the
           box is what is hit. */
        width: 2.5rem;
        height: 2.5rem;
        margin-right: -.5rem;
        border-radius: .45rem;
        color: var(--ink);
        cursor: pointer;
    }

    .nav-check:focus-visible ~ .nav-toggle {
        outline: 2px solid var(--accent-2);
        outline-offset: 2px;
    }

    .nav-bars { position: relative; }

    .nav-bars,
    .nav-bars::before,
    .nav-bars::after {
        display: block;
        width: 1.15rem;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        transition: transform .18s ease, top .18s ease, background .18s ease;
    }

    .nav-bars::before,
    .nav-bars::after {
        content: '';
        position: absolute;
        left: 0;
    }

    .nav-bars::before { top: -.38rem; }
    .nav-bars::after { top: .38rem; }

    /* Open, the mark is the way out of what it opened. */
    .nav-check:checked ~ .nav-toggle .nav-bars { background: transparent; }
    .nav-check:checked ~ .nav-toggle .nav-bars::before { top: 0; transform: rotate(45deg); }
    .nav-check:checked ~ .nav-toggle .nav-bars::after { top: 0; transform: rotate(-45deg); }

    /* The whole window, behind the panel and in front of everything else, and
       it is part of the label — so a tap anywhere outside the menu closes it
       with no script listening for one. */
    .nav-check:checked ~ .nav-toggle::after {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 25;
    }

    /* The one control kept in the bar, and what pushes it and the menu to the
       end now that the language menu doing that job is inside the drawer. */
    .learn-cta { margin-left: auto; }

    .nav-items {
        display: none;
        position: absolute;
        top: calc(100% + .6rem);
        right: 0;
        z-index: 30;
        flex-direction: column;
        align-items: stretch;
        min-width: 12rem;
        max-width: calc(100vw - 2rem);
        padding: .4rem;
        border: 1px solid var(--line);
        border-radius: .6rem;
        background: var(--bg);
        box-shadow: 0 10px 30px rgb(0 0 0 / .22);
    }

    .nav-check:checked ~ .nav-items { display: flex; }

    /* Rows rather than a row of chips: a menu is read down. */
    .nav-items .help-link,
    .nav-items .lang-menu > summary {
        display: flex;
        align-items: center;
        padding: .6rem;
        border-radius: .4rem;
        font-size: .95rem;
    }

    .nav-items .help-link:hover,
    .nav-items .lang-menu > summary:hover {
        color: var(--ink);
        background: color-mix(in srgb, var(--ink) 6%, transparent);
    }

    .nav-items .lang-menu {
        order: 0;
        margin-left: 0;
        font-size: inherit;
    }

    .nav-items .lang-menu > summary { justify-content: space-between; }

    /* Inside a drawer the language list is an accordion rather than a second
       floating panel: a menu hanging off a menu is a thing to miss by a
       thumb's width. */
    .nav-items .lang-options {
        position: static;
        min-width: 0;
        padding: .1rem 0 .3rem .6rem;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
    }

    .nav-items .lang-option { padding: .5rem .6rem; }

    .nav-items .read-cta {
        justify-content: center;
        margin: .25rem 0;
        padding: .55rem .9rem;
        font-size: .9rem;
    }

    /* Nothing fills it where sign-in is off, and a rule above an empty box is
       a divider between a menu and nothing. */
    .nav-items .account:empty { display: none; }

    /* Below the links and ruled off from them: who you are is not a place to
       go. */
    .nav-items .account {
        flex-wrap: wrap;
        gap: .5rem;
        margin-top: .25rem;
        padding: .7rem .6rem .4rem;
        border-top: 1px solid var(--line);
        font-size: .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-bars,
    .nav-bars::before,
    .nav-bars::after { transition: none; }
}

section.help { margin-bottom: 2rem; }

section.help h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent-2);
    border-bottom: 1px solid var(--line);
    padding-bottom: .3rem;
}

section.help p { max-width: 40rem; }
section.help dl { margin: 0; max-width: 40rem; }
section.help dt { font-weight: 600; margin-top: .9rem; }
section.help dd { margin: .15rem 0 0; color: var(--muted); }
section.help dd a { color: var(--accent); }

/* The per-language feature lists. Same width and same muted body as the
   definition lists they replaced, so the page reads as one thing. */
.help-list {
    max-width: 40rem;
    margin: .4rem 0 0;
    padding-left: 1.1rem;
    color: var(--muted);
}

.help-list li { margin-top: .55rem; }
.help-list li::marker { color: var(--line); }
.help-list strong { color: var(--ink); font-weight: 600; }
.help-list a { color: var(--accent); }

section.help code {
    font-size: .9em;
    padding: .1rem .3rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .25rem;
}

/* A touch heavier: gradient text needs the extra weight to stay readable at
   the tagline's size. */
header.site .tagline .gradient { font-weight: 600; }

.search { display: flex; gap: .5rem; margin: 0 0 1rem; }

.search select {
    padding: .6rem .5rem;
    font-size: 1rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .4rem;
    cursor: pointer;
}

/* Holds the input and the suggestion list that hangs off it. */
.search-field { position: relative; flex: 1; min-width: 0; display: flex; }

.search input[type="search"] {
    flex: 1;
    min-width: 0;
    padding: .6rem .8rem;
    font-size: 1rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .4rem;
}

.search button {
    padding: .6rem 1rem;
    font-size: 1rem;
    color: var(--bg);
    background: var(--accent);
    border: 0;
    border-radius: .4rem;
    cursor: pointer;
}

.search button:disabled { opacity: .6; cursor: default; }

p.intro { color: var(--muted); max-width: 34rem; margin: 0 0 2rem; }

h1.headword { font-size: 2.4rem; margin: 0 0 .2rem; }
.headword-meta { color: var(--muted); margin: 0 0 2rem; }

section.entry { margin-bottom: 2rem; }
section.entry.grammar h2 { color: var(--accent-2); }

section.entry h2 { font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: .3rem; }

ol.senses { padding-left: 1.4rem; }
ol.senses li { margin-bottom: .5rem; }
.tag { display: inline-block; font-size: .75rem; color: var(--muted); border: 1px solid var(--line); border-radius: .3rem; padding: 0 .35rem; margin-left: .3rem; }

table.morph { border-collapse: collapse; width: 100%; }
table.morph th, table.morph td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); }
table.morph th { color: var(--muted); font-weight: 500; width: 10rem; }

/* Anchored to the input so the list hangs under it rather than pushing the
   page down as it appears. */
.suggestions {
    position: absolute;
    top: calc(100% + .25rem);
    left: 0;
    right: 0;
    z-index: 20;
    list-style: none;
    margin: 0;
    padding: .25rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .4rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

.suggestions a {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .35rem .5rem;
    border-radius: .3rem;
    color: var(--ink);
    text-decoration: none;
}

.suggestions a:hover { background: var(--bg); color: var(--accent); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

.plan {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: 1rem 1.1rem;
}

.plan.current { border-color: var(--accent-2); }
.plan h2 { margin: 0; font-size: 1.2rem; }
.plan-price { margin: .35rem 0 0; font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.plan-current { margin: .1rem 0 0; font-size: .75rem; color: var(--accent-2); text-transform: uppercase; letter-spacing: .06em; }
.plan ul { list-style: none; margin: .8rem 0; padding: 0; }
.plan li { padding: .15rem 0; color: var(--muted); font-size: .9rem; }
.plan li::before { content: '·'; margin-right: .45rem; color: var(--accent-2); }
.plan-note { margin: .5rem 0 0; font-size: .8rem; color: var(--muted); }
.plan-action .forms-open { display: inline-block; text-decoration: none; }

.matches { margin-bottom: 1.5rem; }

.matches h2 {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: .3rem;
    margin: 0 0 .6rem;
}

.matches ul { list-style: none; margin: 0; padding: 0; }
.matches li { display: flex; align-items: baseline; gap: .5rem; padding: .18rem 0; }
.matches li a { font-weight: 600; text-decoration: none; }
.matches li a:hover { text-decoration: underline; }
.match-definition { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.strip-row { display: flex; align-items: flex-start; gap: .6rem; }
.strip-row .strip { flex: 1; }

/* Its own line between the sentence and what the sentence is about. Indented
   to the words rather than to the play button's column, so it reads as
   belonging to the sentence above it — and only where that button is there to
   hold the column: a language with no voice starts its words at the margin,
   and `.play` plus the row's gap is exactly this much. */
.strip-report { margin: .35rem 0 0; }
.strip-report.indented { padding-left: 2.4rem; }

/* Anchored, not floating with the words: one press speaks the whole sentence. */
.play {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    flex: none;
    padding: 0;
    color: var(--accent-2);
    background: transparent;
    /* The ring is a shadow rather than a border, and it is cross-faded rather
       than recoloured. Both halves matter and only the first was done: a 1px
       border on a circle covers a fractional device pixel at fractional DPRs,
       so it is antialiased differently at every angle — but *transitioning the
       ring's colour* re-rasterises that curve every frame whichever property
       draws it, and wherever the invalidated rectangle rounds a device pixel
       short, the last frame's edge stays on screen. Hence the stray lit pixels
       after the pointer leaves. The accent ring therefore lives on ::before and
       is faded in: an opacity transition is composited from a single
       rasterisation instead of being redrawn per frame, so there is no freshly
       antialiased edge to leave behind. */
    border: 0;
    box-shadow: inset 0 0 0 1px var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: color .12s ease, opacity .12s ease;
}

/* Inset rather than sized, so it tracks both sizes the button comes in. */
.play::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px var(--accent-2);
    opacity: 0;
    transition: opacity .12s ease;
    pointer-events: none;
}

.play:hover::before,
.play.playing::before { opacity: 1; }

.play svg { width: .95rem; height: .95rem; fill: currentColor; overflow: visible; }

/* The speaker cone is filled, the sound waves are drawn. */
.play svg .wave {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.3;
    stroke-linecap: round;
}
.play.loading { opacity: .5; cursor: progress; }
/* The ring comes from ::before in this state too, so the two cannot disagree. */
.play.playing { color: var(--bg); background: var(--accent-2); }

.detail-head .play { margin-left: .5rem; vertical-align: middle; }

h1.headword { display: flex; align-items: center; gap: .6rem; }
h1.headword .play { width: 2rem; height: 2rem; }

/* Token strip: every word stays where it was written. A discontinuous verb form
   is shown by lighting its members together on hover, not by moving them. */
.strip {
    display: flex;
    flex-wrap: wrap;
    /* A row gap where there was none. The strip used to hold one line of text
       per row and could pack them tight; a reading sits *above* its word, so
       with no gap the furigana of a wrapped row lands on the words above it.
       Only where there are readings, for the same reason as the padding. */
    gap: 0;
    margin-bottom: 1.5rem;
    line-height: 1;
    /* Chips with a reading are taller than chips without. Aligned at the
       bottom the words sit on one line and the readings rise off it, which is
       where a reader expects them; centred, every word in the row shifts up
       and down by whether it happens to contain kanji. */
    align-items: flex-end;
}

/* Reserved on every chip, not only the ones with a reading, so a row of words
   is one height whether or not it has kanji in it and the baseline does not
   stagger along the sentence.
   
   Only in a language that has readings at all. Unconditional, this put a tall
   empty band over every French and Latin word — room kept for furigana that
   language will never have. `reads` comes from whether the language module
   defines a `ruby`, so a language gains the space by gaining readings. */
.strip.reads .chip { padding-top: 1.15em; }

.strip.reads { gap: .5rem 0; }

.chip ruby { ruby-position: over; ruby-align: center; }

.chip rt {
    font-size: .5em;
    /* Its own line height, or the reading inherits the strip's 1 and sits on
       the word. */
    line-height: 1.1;
    color: var(--muted);
    /* Kana are wide; without this a two-character word with a five-kana
       reading pushes its neighbours apart. */
    letter-spacing: -.02em;
    user-select: none;
}

/* A reading is a hint, not part of the sentence: it should not light up with
   the word it belongs to, or a highlighted verb turns into a block of colour.
   Muted where the chip keeps the page's background, and the chip's own colour
   dimmed where it does not — a selected chip is filled with the accent, and
   grey on that is a reading nobody can read. */
.chip.active rt { color: var(--muted); }
.chip.selected rt { color: inherit; opacity: .7; }

.clause-word ruby { ruby-position: over; }
.clause-word rt { font-size: .55em; line-height: 1.1; color: var(--muted); user-select: none; }
.clauses { row-gap: .8rem; }

.chip {
    font: inherit;
    font-size: 1.05rem;
    color: var(--ink);
    background: transparent;
    border: 1px solid transparent;
    border-radius: .35rem;
    padding: .35rem .45rem;
    cursor: pointer;
    transition: color .12s ease, background .12s ease, text-decoration-color .12s ease;
}

/* Hovering anywhere in the strip underlines every word at once, so the reader
   learns the whole sentence is clickable, not just the word under the cursor. */
.strip:hover .chip {
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--muted);
    text-underline-offset: .3em;
}

.strip:hover .chip.active { text-decoration-color: var(--accent-2); }
.strip:hover .chip.selected { text-decoration-color: currentColor; }

/* Low contrast divider between words: var(--line) sits just off the background
   in both themes, so it separates without competing with the words. */
.sep {
    align-self: center;
    color: var(--line);
    user-select: none;
    pointer-events: none;
}

.chip:hover {
    background: var(--panel);
    border-color: var(--line);
}

.chip.active {
    color: var(--accent-2);
    background: var(--panel);
    border-color: var(--line);
}

.chip.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

.detail {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: 1rem 1.1rem;
}

.detail.linked { border-left: 3px solid var(--accent-2); }
.detail-head { font-size: 1.5rem; margin: 0 0 .2rem; }
.detail-infl { margin: 0 0 .8rem; font-size: .85rem; color: var(--muted); }
.detail-lemma { margin: 0 0 .3rem; font-weight: 600; }
.detail-none { color: var(--muted); font-size: .9rem; margin: 0; }

/* Deliberately quiet: a source credit, not a call to action. */
.detail-source { margin: .9rem 0 0; text-align: right; font-size: .75rem; }

.detail-source a {
    color: var(--muted);
    text-decoration: none;
    border-bottom: 1px dotted var(--line);
}

.detail-source a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.licence { margin: 1rem 0 0; font-size: .75rem; color: var(--muted); }

/* Present but quiet: a way in, not a call to action. */
.forms-open {
    font: inherit;
    font-size: .8rem;
    color: var(--accent-2);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: .35rem;
    padding: .25rem .6rem;
    margin: 0 0 1rem;
    cursor: pointer;
}

.forms-open:hover { border-color: var(--accent-2); background: var(--panel); }

/* The word page puts it directly under the grammar table, whose last row ends
   in a rule — so with only the button's own bottom margin it read as a cell of
   that table rather than as the way out of it. The analyser's copy sits in
   `.detail-actions`, which has its own gap. */
section.entry.grammar .forms-open { margin-top: 1rem; }

.more { display: block; margin: .5rem 0 0; }
.more:disabled { opacity: .45; cursor: default; }
.more:disabled:hover { box-shadow: none; border-color: var(--line); background: transparent; }

.detail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.detail-actions .forms-open { margin: 0; }

ol.sentences { margin: 0; padding-left: 1.3rem; }
ol.sentences li { margin-bottom: 1rem; }

.sentence { margin: 0; font-size: 1.05rem; }

/* Every word is a link, so they stay in the body colour: underlining ten words
   a line would make the sentence hard to read rather than easy to use. */
.sentence a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; }
.sentence a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.analyse-sentence {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    padding: 0;
    margin-left: .4rem;
    vertical-align: -.2rem;
    color: var(--accent-2);
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    opacity: .55;
    transition: opacity .12s ease, box-shadow .12s ease;
}

.analyse-sentence svg { width: .8rem; height: .8rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.analyse-sentence:hover { opacity: 1; box-shadow: inset 0 0 0 1px var(--accent-2); }
.sentence-translation { margin: .1rem 0 0; color: var(--muted); }

.sentence-credit { margin: .2rem 0 0; font-size: .72rem; color: var(--muted); }
.sentence-credit a { color: var(--muted); text-decoration: none; border-bottom: 1px dotted var(--line); }
.sentence-credit a:hover { color: var(--accent); border-bottom-color: var(--accent); }

.modal {
    width: min(52rem, calc(100vw - 2rem));
    /* dvh, not vh: a phone's 100vh is the window with the address bar scrolled
       away, so a dialog measured in vh is taller than the room it has the
       moment it opens. */
    max-height: calc(100dvh - 4rem);
    padding: 1.5rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .6rem;
}

.modal::backdrop { background: rgba(0, 0, 0, .55); }

/* The platform scrollbar is the one piece of chrome the palette does not reach,
   and on a dark panel it reads as a bright stripe. Two syntaxes: Chrome and
   Firefox honour the standard properties, Safari still wants the webkit ones.
   Chrome ignores the webkit rules once scrollbar-color is set, so the two do
   not fight. */
.modal {
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    /* Reserve the gutter so opening a long modal does not shift its content. */
    scrollbar-gutter: stable;
}

.modal::-webkit-scrollbar { width: 10px; }
.modal::-webkit-scrollbar-track { background: transparent; }

.modal::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 999px;
    /* A border in the panel colour insets the thumb without a visible track. */
    border: 3px solid var(--panel);
}

.modal::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.modal-dismiss { float: right; margin: -.5rem -.5rem 0 0; }

.modal-dismiss button {
    font: inherit;
    color: var(--muted);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: .25rem .5rem;
}

.modal-title { margin: 0 0 1rem; font-size: 1.4rem; }

/* Sections flow into columns, so a 18 section conjugation stays scannable. */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1.2rem;
}

.forms-grid h4 {
    margin: 0 0 .3rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent-2);
    border-bottom: 1px solid var(--line);
    padding-bottom: .25rem;
}

.forms-grid table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.forms-grid th { text-align: left; font-weight: 400; color: var(--muted); padding: .15rem .5rem .15rem 0; white-space: nowrap; }
.forms-grid td { padding: .15rem 0; }

/* The word modal: what a reader asking 'more about this word' wanted, where
   they already are. Opened from a flashcard and from the reading page, both of
   which lose something when a reader navigates out of them — a session's queue,
   or their place in a book. */
.word-about .modal-title { margin-bottom: .4rem; }

/* What the sentence made of the word, which the senses below cannot say. */
.word-about-desc { margin: 0 0 .9rem; font-size: .9rem; color: var(--muted); }

/* The way out, above the definitions rather than under the conjugation: on a
   phone the modal is a sheet and a verb's paradigm is a long scroll, so a
   button at the foot of it is a button nobody finds. */
.word-about-out { margin: 0 0 1.1rem; }
.word-about-out .forms-open { display: inline-block; margin: 0; text-decoration: none; }

.word-about-entry { margin-bottom: 1.1rem; }
.word-about-entry:last-child { margin-bottom: 0; }

/* The same heading the forms grid uses, and scoped with `>` so the sections
   inside one keep their own. */
.word-about-entry > h4 {
    margin: 0 0 .45rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--accent-2);
    border-bottom: 1px solid var(--line);
    padding-bottom: .25rem;
}

.word-about ol.senses { margin: 0; font-size: .95rem; }

/* 'More about' opens that modal and used to be a link to the word page, so it
   keeps a link's appearance: what the reader is asking for has not changed,
   only where the answer arrives. A <button> takes neither the font nor the
   colour from its surroundings, hence the resets — but not its size, which the
   card's own class states and the panel's inherits below. */
button.card-answer-more,
.panel-about-open {
    font-family: inherit;
    line-height: inherit;
    color: var(--accent);
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

.panel-about-open { font-size: inherit; }

.members { display: grid; gap: .8rem; }
.member { border-top: 1px dashed var(--line); padding-top: .7rem; }
.member-text { margin: 0 0 .2rem; font-size: 1.05rem; font-weight: 600; color: var(--accent-2); }

.token-pos { font-size: .75rem; color: var(--muted); margin-left: .5rem; text-transform: lowercase; font-weight: 400; }

.notice { background: var(--panel); border: 1px solid var(--line); border-radius: .4rem; padding: .6rem .8rem; margin-bottom: 1.5rem; font-size: .9rem; }
.error { color: #b3261e; }
.empty { color: var(--muted); }

footer.site {
    margin-top: 4rem;
    /* Clear of the home indicator, which sits over the last 34px of the page
       on a phone with no home button. */
    padding: 1.5rem 0 calc(3rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .85rem;
}

/* The learning platform ---------------------------------------------------
   Deck cards echo the plan cards on the pricing page: the same panel, border
   and radius, so the two lists read as the same kind of thing. */
/* Denser than it was. Four broad decks looked well as big tiles; the catalogue
   is eighteen and a reader's own on top, and every row of height is a row
   somebody has to scroll past to reach the deck they came for. */
.decks { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: .7rem; margin: .6rem 0 1.6rem; }

.deck {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: .75rem .85rem;
    display: flex;
    flex-direction: column;
}

.deck h2 { margin: .1rem 0 0; font-size: .98rem; line-height: 1.3; }

/* Two lines, then an ellipsis: a tile is a label, not a description, and a
   ragged grid is worse than a clipped sentence. */
.deck-blurb {
    margin: .25rem 0 0;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Teal, like every other thing the grammar layer generates. */
.deck-kind {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

.deck-size { margin: .45rem 0 0; font-size: .75rem; color: var(--muted); }
.deck-size strong { color: var(--ink); font-weight: 600; }

/* The day's work, in the same two colours the review bar uses for the same two
   numbers — a reader who has seen them mid-session should not have to learn
   them again on the way in. A shade larger than the size above it, because
   this is the line that decides which deck gets opened. */
.deck-today { margin: .3rem 0 0; display: flex; gap: .7rem; font-size: .78rem; color: var(--muted); }
.deck-clear { color: var(--accent-2); }

/* A sample of what the deck actually holds, drawn fresh on each visit: a deck
   is a query, so showing what it returns is showing what it is. */
.deck-examples { margin: .7rem 0 0; padding: .7rem 0 0; border-top: 1px solid var(--line); list-style: none; }
.deck-examples li { margin: 0 0 .45rem; font-size: .9rem; line-height: 1.45; }
.deck-examples li:last-child { margin-bottom: 0; }
.deck-examples a { text-decoration: none; }
.deck-examples a:hover { text-decoration: underline; }
.deck-credit { font-size: .7rem; color: var(--muted); }

.deck-action { margin-top: auto; padding-top: .7rem; display: flex; align-items: center; gap: .5rem; }

/* Pushed to the end of the row and drawn rather than written: Study, Export
   and Forget are things done to a deck, and this one is what the deck is. */
.deck-tune {
    margin-left: auto;
    display: inline-flex;
    padding: .2rem;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: .3rem;
    cursor: pointer;
}

.deck-tune:hover { color: var(--accent-2); }
.deck-tune:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

.gear { width: 1rem; height: 1rem; fill: currentColor; }
.deck-soon { font-size: .78rem; color: var(--muted); margin: 0; }

/* What the free plan does not include, said once and plainly rather than as a
   locked button on every deck. */
.locked {
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-2);
    border-radius: .4rem;
    padding: .9rem 1.1rem;
    margin: 1.5rem 0;
}

.locked h2 { margin: 0 0 .35rem; font-size: .95rem; }
.locked p { margin: 0; font-size: .88rem; color: var(--muted); }
.locked ul { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .88rem; color: var(--muted); }

/* Sign-in ---------------------------------------------------------------- */
.signin { max-width: 26rem; margin: 3rem auto; text-align: center; }
.signin h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
.signin p { color: var(--muted); font-size: .92rem; }

.signin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin: 1.2rem 0 .4rem;
    padding: .6rem 1.4rem;
    border-radius: 999px;
    font-size: .95rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
    box-shadow: 0 1px 2px rgb(0 0 0 / .18);
}

.signin-button:hover { filter: brightness(1.06); }
.signin-note { font-size: .78rem; }

/* The review loop -------------------------------------------------------- */
.review { max-width: 34rem; margin: 1.5rem auto; }

.review-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: .6rem;
    font-size: .78rem;
    color: var(--muted);
}

.review-bar a { margin-left: auto; color: var(--muted); text-decoration: none; }
.review-bar a:hover { color: var(--accent); }

/* The two counts, coloured apart so the pair reads at a glance rather than as
   a sentence: due is the work the schedule set, new is the work the deck is
   adding. Both go muted at nought, which is the whole point of showing them —
   a reader should be able to see the end coming. */
.tally { display: inline-flex; align-items: baseline; gap: .25rem; }
.tally-due { color: var(--accent-2); font-weight: 600; }
.tally-new { color: var(--brand-mid); font-weight: 600; }
/* The red of Again rather than a fourth colour: a card is in a learning step
   because it was failed or is new, and this is the pile still being worked on.
   Anki paints the same number red for the same reason. */
.tally-learning { color: var(--brand-to); font-weight: 600; }
.tally-due:empty, .tally-new:empty, .tally-learning:empty { color: inherit; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .6rem;
    padding: 1.4rem 1.5rem 1.1rem;
}

.card-ask {
    margin: 0 0 .9rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

.card-ask strong { color: var(--ink); font-weight: 600; text-transform: none; letter-spacing: 0; }

/* The sentence is the card. Larger than body text and loosely set, because it
   is being read closely rather than skimmed. */
.card-sentence { margin: 0; font-size: 1.3rem; line-height: 1.7; }

.card-sentence .target { border-bottom: 2px solid var(--accent-2); }

/* A cloze blank keeps the width of what it hides, so the sentence does not
   reflow when the answer appears. */
.blank {
    display: inline-block;
    height: 1.1em;
    border-bottom: 2px solid var(--accent-2);
    vertical-align: text-bottom;
}

/* Every word is a button once the answer is out — the click-through the main
   page has, with no separate control to find. */
.card-sentence .word {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    border-radius: .15rem;
}

/* Turning the word into a button zeroes its border, and with it the mark that
   says which word the card is about — needed most on the back, where the answer
   below gives the headword and the sentence gives the form it took. */
.card-sentence .word.target { border-bottom: 2px solid var(--accent-2); }

/* Hovering anywhere on the card underlines every word at once — the same cue
   the token strip gives on the main page, and for the same reason: the whole
   sentence is clickable, not just the word under the cursor. Nothing marks them
   the rest of the time, because a card is meant to be read.

   The card rather than the sentence: between two words the pointer is over a
   whitespace text node, which does not put the paragraph into :hover, so the
   cue flickered as the mouse crossed the gaps. The card is one unbroken box
   and is what a reader takes the sentence to be anyway. */
.card:hover .word {
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--muted);
    text-underline-offset: .25em;
}

/* The word the card is about keeps its own colour, so the answer stays legible
   as the answer while everything else advertises itself as clickable. */
.card:hover .word.target { text-decoration-color: var(--accent-2); }
.card:hover .word.selected { text-decoration-color: currentColor; }

.card-sentence .word:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.card-sentence .word.selected { background: color-mix(in srgb, var(--accent-2) 22%, transparent); }
.card-sentence .word:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* Under the sentence rather than beside the answer, where a speaker icon reads
   as playing the single word next to it. */
.card-listen { display: flex; align-items: center; gap: .5rem; margin-top: .7rem; font-size: .78rem; color: var(--muted); }

/* One panel under the sentence, for the answer and for any word tapped after
   it. Its own section rather than a boxed aside, which is what it looked like
   when the looked-up word had a panel of its own: the answer is the point of
   the back of the card, and a bordered box beneath the answer read as a
   footnote to it. */
.card-answer { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.card-answer-head { display: flex; align-items: baseline; gap: .5rem; font-size: 1.1rem; }
/* The flex gap already spaces it; the shared rule's own margin would double. */
.card-answer-head .token-pos { margin-left: 0; }
.card-answer-desc { margin: .25rem 0 0; font-size: .85rem; color: var(--accent-2); }
/* The auxiliary's explanation: a note about the form above it rather than part
   of it, so it sits at the description's size and the body's colour — quieter
   than the gloss, which is what the reader came for, and not coloured like the
   form, which is what they were asked. */
.card-answer-note { margin: .35rem 0 0; font-size: .85rem; }
.card-answer-gloss { margin: .5rem 0 0; font-size: .95rem; }
.card-answer-more { display: inline-block; margin-top: .6rem; font-size: .8rem; }

.card-answer-more-senses { margin-top: .35rem; }

.card-answer-more-senses > summary {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--accent-2);
    cursor: pointer;
    list-style: none;
}

.card-answer-more-senses > summary::-webkit-details-marker { display: none; }

.card-answer-more-senses > summary::after {
    content: '';
    width: .28rem;
    height: .28rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-.1em) rotate(45deg);
    transition: transform .15s ease;
}

.card-answer-more-senses[open] > summary::after { transform: translateY(.1em) rotate(-135deg); }

.card-answer-more-senses ol {
    margin: .35rem 0 0;
    padding-left: 1.4rem;
    font-size: .88rem;
    line-height: 1.5;
    color: var(--muted);
}

.card-answer-more-senses li { margin-bottom: .2rem; }
.card-credit { margin: 1rem 0 0; font-size: .7rem; color: var(--muted); }
.card-credit a { color: var(--muted); }

.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: 1rem; }

.grade, .reveal {
    font: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .1rem;
    padding: .6rem .3rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .45rem;
    cursor: pointer;
}

.grade:hover, .reveal:hover { border-color: var(--accent-2); }

.reveal {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    gap: .6rem;
    font-weight: 600;
    padding: .75rem;
}

/* The verdict on a card the app marked, carrying the same two colours the box
   above it took, so the mark reads as one thing rather than two. */
.reveal-pass { border-color: var(--accent-2); }
.reveal-fail { border-color: var(--brand-to); }

.grade-label { font-weight: 600; font-size: .9rem; }
.grade-hint { font-size: .7rem; color: var(--muted); }

/* The number that grades it, shown rather than explained: the keyboard is how
   anyone reviews at length. */
.grade-key {
    font-size: .65rem;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: .2rem;
    padding: 0 .3rem;
}

/* Again is the one that costs something, so it is the one that is coloured. */
.grade-1:hover { border-color: var(--brand-to); }

.card-status { margin: 2rem auto; max-width: 30rem; text-align: center; color: var(--muted); }
.card-status strong { color: var(--ink); }

/* The card that says the deck is done. Shaped like every other card on
   purpose: it arrives in the place the next card would have, which is what
   makes it read as the end of the run rather than as the session having
   stopped working. */
.card-cleared { text-align: center; padding: 2rem 1.5rem 1.8rem; }

.cleared-mark {
    margin: 0 0 .6rem;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--accent-2);
}

.cleared-head { margin: 0; font-size: 1.25rem; font-weight: 600; }
.cleared-count { margin: .5rem auto 0; max-width: 26rem; color: var(--muted); font-size: .9rem; }
.cleared-count strong { color: var(--ink); }
.cleared-capped { margin: .7rem auto 0; max-width: 26rem; color: var(--muted); font-size: .82rem; }

/* Said on the cleared card as well as in the bar, because the bar is gone by
   then and 'clear' and 'six cards in ten minutes' are both true. */
.cleared-learning { margin: .7rem auto 0; max-width: 26rem; color: var(--muted); font-size: .82rem; }
.cleared-learning strong { color: var(--brand-to); }

/* One control or two, each filling its share: `repeat(4, 1fr)` is right for
   four grades and leaves a single button stranded in the left quarter. */
.grades-cleared { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.cleared-go { text-decoration: none; }

/* The deck list's way in. */
.deck-start {
    display: inline-block;
    padding: .4rem 1rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
}

.deck-start:hover { filter: brightness(1.06); }

@media (max-width: 30rem) {
    .grades { grid-template-columns: repeat(2, 1fr); }
    .card-sentence { font-size: 1.15rem; }
}

/* The paid catalogue, listed rather than hidden: a locked deck is a specific
   answer to a specific difficulty, which is the argument for the plan. */
.deck-section {
    margin: 0;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

/* Shown, greyed, and pressable. Dimmed rather than hidden because the point is
   that a reader can see what they would get — and it lifts on hover, so a tile
   reads as something to press rather than something broken. */
.deck-locked {
    border-style: dashed;
    cursor: pointer;
    opacity: .62;
    filter: saturate(.35);
    transition: opacity .12s ease, filter .12s ease;
}

.deck-locked:hover,
.deck-locked:focus-within {
    opacity: 1;
    filter: none;
    border-color: var(--accent-2);
}

.deck-locked .deck-size strong { color: var(--muted); }

/* What a plan buys, asked about one deck. */
.upgrade {
    width: min(30rem, calc(100vw - 2rem));
    padding: 1.4rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: .7rem;
    background: var(--panel);
    color: var(--ink);
}

.upgrade::backdrop { background: rgb(0 0 0 / .5); }

.upgrade-close {
    position: absolute;
    top: .5rem;
    right: .7rem;
    border: 0;
    background: none;
    font-size: 1.2rem;
    color: var(--muted);
    cursor: pointer;
}

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

.upgrade-eyebrow {
    margin: 0;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

/* The deck they pressed, in the brand gradient: it is the thing being offered,
   so it should read as the headline rather than as a caption. */
.upgrade-deck {
    margin: .2rem 0 .1rem;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--accent);
}

@supports (background-clip: text) or (-webkit-background-clip: text) {
    .upgrade-deck {
        background: linear-gradient(100deg, var(--brand-from), var(--brand-mid) 55%, var(--brand-to));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
}

.upgrade-blurb { margin: 0 0 .15rem; font-size: .9rem; color: var(--muted); }
.upgrade-size { margin: 0; font-size: .82rem; color: var(--muted); }

.upgrade-gains { margin: 1rem 0 0; }
.upgrade-lead { margin: 0 0 .4rem; font-size: .88rem; }
.upgrade-gains ul { margin: 0; padding-left: 1.1rem; }
.upgrade-gains li { margin: .3rem 0; font-size: .87rem; line-height: 1.45; }
.upgrade-gains strong { color: var(--ink); }

.upgrade-actions {
    display: flex;
    align-items: center;
    gap: .7rem;
    margin-top: 1.2rem;
}

.upgrade-go {
    padding: .45rem 1rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
}

.upgrade-go:hover { filter: brightness(1.06); }

.upgrade-later {
    border: 0;
    background: none;
    font: inherit;
    font-size: .85rem;
    color: var(--muted);
    cursor: pointer;
}

.upgrade-later:hover { color: var(--ink); }

.deck-unlock {
    display: inline-block;
    padding: .35rem .9rem;
    border-radius: 999px;
    border: 1px solid var(--accent-2);
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--accent-2);
}

.deck-unlock:hover { background: color-mix(in srgb, var(--accent-2) 12%, transparent); }

/* Deck sections and the way in to building one -------------------------- */
.deck-section-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0 .2rem;
}

.deck-section-row .deck-section { margin: 0; }
h2.deck-section:not(.deck-section-row *) { margin: 2rem 0 .2rem; }

/* The one action on this page that makes something new, so it carries the
   gradient the header's Learn button does. */
.deck-create {
    margin-left: auto;
    font: inherit;
    padding: .4rem .9rem;
    border: 0;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
    box-shadow: 0 1px 2px rgb(0 0 0 / .18);
}

.deck-create:hover { filter: brightness(1.06); }
.deck-create:active { transform: translateY(1px); }

.deck-empty { margin: .4rem 0 1.6rem; font-size: .88rem; color: var(--muted); max-width: 34rem; }

.deck-mine { border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line)); }

.deck-forget {
    font: inherit;
    font-size: .75rem;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
}

.deck-forget:hover { color: var(--brand-to); text-decoration: underline; }

/* A deck that has just been saved. It arrives at the top of the reader's own
   list, so the animation is there to say "this one" rather than to decorate. */
@keyframes deck-arrive {
    from { opacity: 0; transform: translateY(-.5rem) scale(.97); }
    to   { opacity: 1; transform: none; }
}

.deck-fresh {
    animation: deck-arrive .35s ease-out;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 22%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .deck-fresh { animation: none; }
}

/* The builder ------------------------------------------------------------ */
.builder {
    width: min(30rem, calc(100vw - 2rem));
    padding: 1.4rem 1.5rem;
    color: var(--ink);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: .6rem;
}

.builder::backdrop { background: rgb(0 0 0 / .5); }
.builder h2 { margin: 0; font-size: 1.15rem; }
.builder-lede { margin: .3rem 0 1.1rem; font-size: .85rem; color: var(--muted); }


/* Reporting a sentence. The opener is deliberately quiet — it sits at the foot
   of a card beside the source line, and on the analyser under the sentence it
   reports, where it should be findable rather than inviting. */
.report-open {
    border: 0;
    background: none;
    padding: 0 .2rem;
    font: inherit;
    font-size: .72rem;
    color: var(--muted);
    text-decoration: underline;
    text-underline-offset: .18em;
    cursor: pointer;
}
.report-open:hover, .report-open:focus-visible { color: var(--accent); }

/* The sentence being reported, shown so the reader can see it is the one they
   meant. A quotation rather than a field: nothing here is editable. */
.report-sentence {
    margin: 0 0 .5rem;
    padding: .6rem .75rem;
    border-left: 3px solid var(--accent);
    background: var(--sunk, rgb(255 255 255 / .04));
    font-size: .95rem;
    line-height: 1.5;
}
.report-context { margin: 0 0 1rem; font-size: .75rem; color: var(--muted); }
.report-optional { font-style: normal; text-transform: none; letter-spacing: 0; opacity: .7; }
/* The one thing the shared field rule above does not give it. */
.report-comment { resize: vertical; }

/* The reports board at /admin/reports. Reuses `.report-sentence` and the
   builder's own field rule, so the operator's page and the reader's dialog
   look like one app rather than two — and so a change to a field is one
   change. Nothing here is loaded by the island; the page is plain html. */
.report-tabs {
    display: flex;
    gap: .4rem;
    margin: 0 0 1.2rem;
    flex-wrap: wrap;
}

.report-tab {
    padding: .3rem .7rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .8rem;
    color: var(--muted);
    text-decoration: none;
}

.report-tab-on {
    border-color: var(--accent);
    color: var(--ink);
}

.report-count { opacity: .7; font-variant-numeric: tabular-nums; }

.report-card {
    margin: 0 0 1rem;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: var(--sunk, rgb(255 255 255 / .03));
}

/* A resolved report is kept and set back, because the list is read for what is
   still open. Dimmed rather than hidden: the tab above decides what is here. */
.report-done { opacity: .62; }

.report-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .6rem;
    font-size: .74rem;
    color: var(--muted);
}

.report-id { font-weight: 600; color: var(--ink); }
.report-lang { text-transform: uppercase; letter-spacing: .06em; }
.report-state { color: var(--accent); }
.report-state-done { color: var(--muted); }
.report-who { margin-left: auto; }

/* A description list rather than paragraphs: these three are the fields a
   report is diagnosed from, and reading the prompt against the answer is the
   whole exercise — they belong in two aligned columns. */
.report-fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .2rem .8rem;
    margin: 0 0 .7rem;
    font-size: .85rem;
}

.report-fields dt {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
    padding-top: .12em;
}

.report-fields dd { margin: 0; }

/* The newlines a reader typed are kept by `reports.file`; this is what shows
   them. */
.report-comment {
    margin: 0 0 .7rem;
    white-space: pre-wrap;
    font-size: .9rem;
    line-height: 1.5;
}

.report-silent { color: var(--muted); font-style: italic; }

.report-actions {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    flex-wrap: wrap;
}

.report-stamp {
    font: inherit;
    font-size: .8rem;
    padding: .35rem .8rem;
    border: 1px solid var(--line);
    border-radius: .35rem;
    background: var(--bg);
    color: var(--ink);
    cursor: pointer;
}

.report-stamp:hover, .report-stamp:focus-visible { border-color: var(--accent); }

/* Beside the stamp while it is closed, and a row of its own once it is open:
   a form squeezed into what is left over beside a button leaves a dead column
   under the button and a textarea nobody can write in. */
.report-edit { flex: 0 1 auto; }
.report-edit[open] { flex: 1 1 100%; }
.report-edit > summary {
    cursor: pointer;
    font-size: .8rem;
    color: var(--muted);
    padding: .35rem 0;
}
.report-edit > summary:hover { color: var(--accent); }
.report-edit > form { margin-top: .6rem; }
.report-fixed { margin: 0 0 .7rem; font-size: .72rem; color: var(--muted); }
.report-none { color: var(--muted); }

/* The source line and the report link share the foot of a card. */
.card-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.builder-field { display: block; margin-bottom: .8rem; }
.builder-field > span {
    display: block;
    margin-bottom: .25rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

/* `textarea` belongs here rather than in a rule of its own: a field that has
   to be *told* to match the fields beside it will stop matching them the next
   time these change. Left out, the report box fell through to the browser's
   own styling, which is white paper in a dark room. */
.builder-field select,
.builder-field textarea,
.builder-field input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: .92rem;
    padding: .5rem .6rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: .4rem;
}

/* The number is the point of the form: it answers "is this deck worth
   making?" before anything is saved. */
.builder-count {
    margin: 1rem 0 0;
    padding: .6rem .8rem;
    font-size: .9rem;
    background: var(--bg);
    border-left: 3px solid var(--accent-2);
    border-radius: .3rem;
    color: var(--muted);
}

.builder-count strong { color: var(--ink); font-size: 1.05rem; }
.builder-count-empty { border-left-color: var(--brand-to); }
.builder-failed { margin: .6rem 0 0; font-size: .85rem; color: var(--brand-to); }

/* Three hundred and sixty-seven verbs is a list, so it scrolls inside its own
   box rather than making the dialog do it: a reader ticking a verb should not
   lose sight of the count underneath. */
.verb-filter {
    width: 100%;
    margin: .35rem 0 .45rem;
    padding: .4rem .55rem;
    font: inherit;
    font-size: .85rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: .35rem;
}

.verb-filter:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.verb-list { max-height: 11rem; overflow-y: auto; }
.verb-more, .verb-none { margin: .4rem 0 0; font-size: .75rem; color: var(--muted); }

/* One number and what it does. Labelled above and explained below, because
   'new cards a day' is two different promises depending on whether nought
   means stop or means default, and the box cannot say which. */
.limit-field { display: block; margin-top: 1rem; }
.limit-name { display: block; font-size: .85rem; font-weight: 600; }

.limit-field input {
    display: block;
    width: 7rem;
    margin-top: .35rem;
    padding: .4rem .55rem;
    font: inherit;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: .35rem;
}

/* A name is words where the two beside it are four digits, so it takes the
   dialog's width rather than the 7rem a daily limit wants. Capped, because a
   sixty-character box stretched across a desktop dialog reads as a search
   field rather than as a label. */
.limit-field input[type="text"] { width: 100%; max-width: 22rem; }

.limit-field input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.limit-note { display: block; margin-top: .3rem; font-size: .78rem; color: var(--muted); line-height: 1.45; }

/* The box beside its label rather than above it, which is what a checkbox
   reads as; the explanation keeps the indent so the two lines of text are one
   column and not a step. */
.limit-check { display: flex; gap: .6rem; margin-top: 1.1rem; align-items: start; cursor: pointer; }
.limit-check input { margin: .15rem 0 0; accent-color: var(--accent-2); width: 1rem; height: 1rem; }
.limit-check .limit-note { margin-top: .2rem; }

.builder-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.2rem; }

.builder-cancel, .builder-save, .builder-danger {
    font: inherit;
    font-size: .88rem;
    padding: .5rem 1.1rem;
    border-radius: 999px;
    cursor: pointer;
}

.builder-cancel { color: var(--muted); background: none; border: 1px solid var(--line); }
.builder-cancel:hover { color: var(--ink); }

.builder-save {
    font-weight: 600;
    border: 0;
    color: var(--on-brand);
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
}

/* The one button here that takes something away, so it is the one that is
   coloured — the same borrowing `grade-1` makes for Again, and for the same
   reason: a destructive control should not look like the save beside it. */
.builder-danger {
    color: var(--brand-to);
    background: none;
    border: 1px solid var(--brand-to);
}

.builder-danger:hover { color: var(--on-brand); background: var(--brand-to); }

.builder-save:hover:not(:disabled) { filter: brightness(1.06); }
.builder-save:disabled { opacity: .5; cursor: default; }

/* Export ------------------------------------------------------------------
   The second accent, because exporting is the grammar layer leaving the site
   rather than another way to start studying. */
.deck-export {
    font: inherit;
    font-size: .78rem;
    padding: .25rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--accent-2);
    background: none;
    color: var(--accent-2);
    cursor: pointer;
}

.deck-export:hover { background: color-mix(in srgb, var(--accent-2) 14%, transparent); }

.exporter { width: min(34rem, calc(100vw - 2rem)); }

.export-limits {
    margin: 1.1rem 0 0;
    padding: .8rem 1rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: .4rem;
}

.export-limits h3 {
    margin: 0 0 .4rem;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

.export-limits ul { margin: 0; padding-left: 1.1rem; font-size: .84rem; color: var(--muted); }
.export-limits li { margin-bottom: .4rem; }
.export-limits li b { color: var(--ink); font-weight: 600; }
.export-limits p { margin: .6rem 0 0; font-size: .78rem; color: var(--muted); }

.export-progress { margin-top: 1.2rem; }
.export-progress p { margin: .5rem 0 0; font-size: .82rem; color: var(--muted); }

.export-bar {
    height: .4rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--line);
    overflow: hidden;
}

.export-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(100deg, var(--brand-from), var(--brand-fill-mid) 55%, var(--brand-to));
    transition: width .4s ease-out;
}

.export-done { margin-top: 1.2rem; }
.export-done p { margin: 0 0 .8rem; font-size: .9rem; }
.export-done code { font-size: .85em; color: var(--accent-2); }
.export-done .builder-save { display: inline-block; text-decoration: none; }

/* Words times cards each is a product the reader should not have to do. */
.export-total {
    margin: 1rem 0 0;
    padding: .6rem .8rem;
    font-size: .9rem;
    color: var(--muted);
    background: var(--bg);
    border-left: 3px solid var(--accent-2);
    border-radius: .3rem;
}

.export-total strong { color: var(--ink); font-size: 1.05rem; }

/* Review schedule -------------------------------------------------------
   A strip beside the heading rather than a panel at the foot of the page. It
   used to be a box with a Fit button in it, and the button was not a decision
   anybody could make: there are either enough answers to fit to or there are
   not. It fits itself now, so what is left is a state to glance at. */
.learn-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Basis zero, not auto. A flex line is wrapped before anything on it is
   shrunk, so the heading's own paragraph — a sentence wide at its natural size
   — pushed the bar onto a line of its own however much room there was. */
.learn-intro { flex: 1 1 0; min-width: 14rem; }

.tune { position: relative; flex: none; }

.tune-button {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .5rem;
    border: 0;
    border-radius: .4rem;
    background: none;
    font: inherit;
    color: var(--muted);
    cursor: pointer;
}

.tune-button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.tune-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.tune-label { font-size: .78rem; letter-spacing: .02em; white-space: nowrap; }

.tune-bar {
    display: block;
    width: 5.5rem;
    height: .3rem;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.tune-bar > span {
    display: block;
    height: 100%;
    background: var(--accent-2);
    transition: width .4s ease-out;
}

/* What a plan buys, in the brand's own colours rather than the grammar teal:
   everything else marked this way on the page is orange. Teal once the fit has
   happened, which is the colour this site gives to what it works out itself. */
.tune-mark { width: .75rem; height: .75rem; fill: var(--brand-mid); }
.tune-mark-fitted { fill: var(--accent-2); }
.tune-locked .tune-bar > span { background: var(--muted); opacity: .55; }

/* Hover on a pointer, focus for a keyboard, and the open class for a tap —
   a phone has no hover to reveal anything with. */
.tune-tip {
    position: absolute;
    top: calc(100% + .4rem);
    right: 0;
    z-index: 20;
    width: min(21rem, calc(100vw - 2rem));
    padding: .6rem .75rem;
    border: 1px solid var(--line);
    border-radius: .45rem;
    background: var(--panel);
    box-shadow: 0 6px 20px rgb(0 0 0 / .18);
    font-size: .78rem;
    line-height: 1.5;
    color: var(--muted);
    opacity: 0;
    visibility: hidden;
    transition: opacity .12s ease, visibility .12s;
}

.tune:hover .tune-tip,
.tune:focus-within .tune-tip,
.tune-open .tune-tip { opacity: 1; visibility: visible; }

.tune-tip em { color: var(--ink); font-style: italic; }

/* The heading takes the whole row first, so the bar drops under it rather than
   squeezing the language name. */
@media (max-width: 34rem) {
    .learn-head { gap: .5rem; }
    .tune-tip { right: auto; left: 0; }
}

/* Tips ------------------------------------------------------------------
   Under the card on a review page, cycling. Unboxed, unlike almost everything
   else here: the card above it is a panel, and a second panel below it would
   read as a second thing to attend to rather than as an aside.

   Every tip occupies the same grid cell, so the strip stands as tall as the
   longest of them and nothing moves as they change — the alternative, one in
   the flow and the rest removed, reflows the page on every change. */
.tips {
    display: grid;
    margin: 2.5rem auto 0;
    max-width: 34rem;
}

.tip {
    grid-area: 1 / 1;
    margin: 0;
    text-align: center;
    text-wrap: balance;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--muted);
    opacity: 0;
    /* Out of the way of a pointer and of a screen reader while it is not the
       one showing; `hidden` would take it out of the grid and let the strip
       collapse to the height of whichever tip is up. */
    visibility: hidden;
    transform: translateY(.3rem);
    transition: opacity .5s ease, transform .5s ease, visibility .5s;
}

.tip-on { opacity: 1; visibility: visible; transform: none; }

.tip em { font-style: italic; color: var(--ink); }

/* The movement is decoration; the change of tip is not, so it still happens. */
@media (prefers-reduced-motion: reduce) {
    .tip { transform: none; transition: opacity .2s linear, visibility .2s; }
}

/* The characters in a word ------------------------------------------------
   What a word entry cannot say in a language written in characters: 読書 is
   reading, and knowing 読 is read and 書 is write makes the next compound
   guessable. Cards rather than a list, because each is a small entry of its
   own and they are read one at a time. */
.kanji { margin-top: 1.4rem; }

/* h3 on the analysis page, where it sits under the word's own h2; h2 on the
   word page, where it is a section of its own beside Noun and Verb. One rule,
   because it is one thing and should not look like two. */
.kanji h2,
.kanji h3 {
    margin: 0 0 .6rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
    font-weight: 600;
}

/* As many as fit, each between a floor and a ceiling. A word is one character
   or six, and `1fr` would stretch a lone card across the whole panel — a card
   about 館 is the same size whether or not it has company. */
.kanji-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 20rem));
    gap: .7rem;
}

.kanji-card {
    display: flex;
    gap: .8rem;
    padding: .7rem .85rem;
    border: 1px solid var(--line);
    border-radius: .5rem;
    background: var(--bg);
}

/* Large, because it is the thing being looked at: a character at body size is
   a character a learner cannot see the strokes of. */
.kanji-char {
    flex: none;
    align-self: flex-start;
    font-size: 2.6rem;
    line-height: 1.1;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.kanji-char:hover { color: var(--accent); border-bottom-color: var(--accent); }

.kanji-body { min-width: 0; }

.kanji-meaning { margin: 0 0 .3rem; font-size: .9rem; line-height: 1.4; }

.kanji-reading {
    margin: 0;
    font-size: .82rem;
    line-height: 1.5;
    color: var(--muted);
    /* Readings run long — 食 has four kun — and must wrap inside the card
       rather than widening it. */
    overflow-wrap: anywhere;
}

/* Fixed width so the three labels line up and the readings start on one edge. */
.kanji-label {
    display: inline-block;
    width: 3.2rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--accent-2);
}

/* The corpus's readings, which are the same alphabet as the kun ones above and
   would read as more of them without something to separate the two. */
.kanji-used { color: var(--ink); }

.kanji-credit {
    margin: .7rem 0 0;
    font-size: .72rem;
    line-height: 1.5;
    color: var(--muted);
}

.kanji-facts {
    display: flex;
    flex-wrap: wrap;
    gap: .15rem .7rem;
    margin: .45rem 0 0;
    font-size: .72rem;
    color: var(--muted);
}

/* Ad slots ---------------------------------------------------------------
   Nothing at all until app.js decides one is being filled: a premium reader,
   or a deployment with no network signed up, should not see the space an ad
   would have taken. */
.ad-slot { display: none; }

.ad-slot.ad-live {
    display: block;
    margin: 1.5rem 0;
    /* Reserved once, so the page does not jump when the ad arrives — layout
       shift is the thing that would cost the search traffic the ads are meant
       to be paid for. */
    min-height: 100px;
    text-align: center;
    overflow: hidden;
}

.ad-slot.ad-live::before {
    content: 'Advertisement';
    display: block;
    margin-bottom: .3rem;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}

@media (max-width: 30rem) {
    .ad-slot.ad-live { margin: 1.1rem 0; }
}

/* The pages a site has to have. Quiet, and on every page, because a policy
   nobody can find is not much of a policy. */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: .8rem;
    font-size: .78rem;
}

.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

/* Expressions found in the sentence -------------------------------------
   Above the token strip, because it explains what the words below it are
   about to fail to explain. */
.idioms {
    margin: 0 0 1.2rem;
    padding: .7rem .9rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent-2);
    border-radius: .4rem;
}

.idioms h2 {
    margin: 0 0 .4rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
}

.idioms ul { margin: 0; padding: 0; list-style: none; }
.idioms li { padding: .15rem 0; font-size: .92rem; line-height: 1.5; }
.idioms li a { font-weight: 600; text-decoration: none; }
.idioms li a:hover { text-decoration: underline; }
.idioms .token-pos { margin: 0 .4rem; }
.idiom-gloss { color: var(--muted); }

/* Sentence structure ------------------------------------------------------
   Between the strip and the word detail, shut until asked for. Teal like the
   expressions panel above it: both say something about the sentence rather
   than about a word, and teal is the colour this site gives to the grammar it
   works out itself.

   The generous margin below is not decoration — the word detail is a bordered
   card, and without the gap an open disclosure reads as its lid. */
.structure { margin: 1.2rem 0 2rem; }

.structure > summary {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--accent-2);
    cursor: pointer;
    list-style: none;
}

/* Safari draws its own triangle through ::-webkit-details-marker. */
.structure > summary::-webkit-details-marker { display: none; }

.structure > summary::after {
    content: '';
    width: .3rem;
    height: .3rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-.1em) rotate(45deg);
    transition: transform .15s ease;
}

.structure[open] > summary::after { transform: translateY(.1em) rotate(-135deg); }

.clause-count { color: var(--muted); letter-spacing: .04em; }

/* One grid for the lot. A box per clause, each indented by its own depth, gave
   every row a different left edge and a rule that lined up with nothing; here
   the labels share a gutter, the sentences share a left edge, and one rail down
   the side holds the block together. */
.clauses {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .5rem .9rem;
    margin: .7rem 0 0;
    padding: .1rem 0 .1rem .9rem;
    border-left: 2px solid var(--line);
}

.clause-label {
    justify-self: start;
    padding-top: .12rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    line-height: 1.5;
    white-space: nowrap;
    color: var(--muted);
}

/* The spine of the sentence, and the one thing worth picking out of the column
   at a glance. Everything else hangs off it, and says so. */
.clause-main { color: var(--accent-2); font-weight: 600; }

.clause-under::before {
    content: '↳';
    margin-inline-end: .3rem;
    /* The arrow is a hint about shape, not a word to read, and at the label's
       own weight it competed with the label. */
    opacity: .55;
}

.clause-words { font-size: .95rem; line-height: 1.6; }

/* A word, not a control: this is a sentence to read, and a row of buttons is
   not readable. The underline on hover is the same affordance the reader uses
   on a page of Latin. */
.clause-word {
    padding: 0 .05rem;
    border: 0;
    border-bottom: 1px solid transparent;
    background: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
}

.clause-word:hover,
.clause-word.selected { border-bottom-color: var(--accent); color: var(--accent); }

/* The rest of a verb form, when the pointer is on one of its words. Teal, not
   the accent: the word under the pointer is what was asked about, and its
   companions are the answer to a different question — what goes with it. */
.clause-word.active { border-bottom-color: var(--accent-2); color: var(--accent-2); }
.clause-word.active.selected,
.clause-word.active:hover { border-bottom-color: var(--accent); color: var(--accent); }
.clause-word:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Where the clause is interrupted by one nested inside it. */
.clause-gap { padding: 0 .2rem; color: var(--muted); }

.clause-tense {
    display: block;
    font-size: .74rem;
    color: var(--muted);
}

/* Under 34rem the gutter costs more than it gives: the labels would wrap and
   the sentences would be squeezed into a column two words wide. */
@media (max-width: 34rem) {
    .clauses { grid-template-columns: 1fr; gap: .15rem; }
    .clause-label { padding-top: .5rem; }
    .clause-body { padding-bottom: .2rem; }
}

/* A character card. The glyph is the question, so it is set large enough to
   read as one rather than as a word in the sentence below it. */
.card-glyph {
    font-size: 1.6em;
    vertical-align: -0.12em;
    font-weight: 600;
}

.card-glyph-detail {
    margin-top: 0.9rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.card-glyph-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.card-glyph-large {
    font-size: 3.2rem;
    line-height: 1;
}

.card-glyph-meanings { margin: 0; font-weight: 600; }
.card-glyph-strokes { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.85em; }

.card-glyph-readings,
.card-glyph-parts {
    margin: 0.6rem 0 0;
    font-size: 0.92em;
}

/* Stroke order. Two sizes: the review card studies one character and gives it
   room, a panel may be listing a dozen and must not become a wall of grids. */
.strokes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    flex: none;
}

.strokes-grid {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--panel);
    cursor: pointer;
}

.strokes-card .strokes-grid { width: 5.5rem; height: 5.5rem; }
.strokes-panel .strokes-grid { width: 3.4rem; height: 3.4rem; }

.strokes-guide {
    stroke: var(--line);
    stroke-width: 1;
    stroke-dasharray: 4 4;
}

.stroke-ghost,
.stroke-draw {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 4.2;
}

/* Where the stroke is going, faint enough not to answer the question of which
   comes next. */
.stroke-ghost { stroke: var(--line); }

/* Drawn to begin with, and hidden by the script as the first thing it does.
   That way a reader with no javascript — or one who has asked for no motion —
   gets the finished character instead of an empty box, and the animation is an
   addition rather than the only way the strokes ever appear. */
.stroke-draw { stroke: var(--ink); stroke-dashoffset: 0; }

.strokes-replay {
    font: inherit;
    font-size: 0.78em;
    color: var(--muted);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.strokes-replay:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
    .strokes-grid { cursor: default; }
    .strokes-replay { display: none; }
}

/* The phonetic series on the back of a card. Quiet: it is context for the
   answer above it rather than a second answer. */
.card-series {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.card-series-head {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin: 0;
}

.card-series-part { font-size: 1.9rem; line-height: 1; }
.card-series-says { color: var(--muted); }
.card-series-count { margin-left: auto; color: var(--muted); font-size: 0.82em; }

/* Said plainly where it applies, because the card the reader is looking at is
   the counter-example and pretending otherwise teaches the wrong lesson. */
.card-series-break {
    margin: 0.4rem 0 0;
    font-size: 0.9em;
    color: var(--accent);
}

.card-series-list {
    margin: 0.5rem 0 0;
    font-size: 1.5rem;
    letter-spacing: 0.12em;
}

.card-series-list a { text-decoration: none; color: var(--ink); }
.card-series-list a:hover { color: var(--accent); }

.card-series-except {
    margin: 0.45rem 0 0;
    font-size: 0.9em;
    color: var(--muted);
}

.card-series-except a { color: inherit; }

/* The same panel as a series, because it is the same kind of fact about the
   same character and a second visual language would say they were different
   kinds of thing. */
.card-twins {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.card-twins-head {
    margin: 0 0 0.4rem;
    font-size: 0.82em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.card-twins-row {
    display: flex;
    align-items: baseline;
    gap: 0.55rem;
    margin: 0.35rem 0 0;
}

.card-twins-glyph {
    font-size: 1.9rem;
    line-height: 1;
    text-decoration: none;
    color: var(--ink);
}

.card-twins-glyph:hover { color: var(--accent); }
.card-twins-gloss { color: var(--muted); }

.card-twins-why {
    margin-left: auto;
    font-size: 0.85em;
    color: var(--muted);
    text-align: right;
}

.card-twins-part { color: var(--accent); font-size: 1.15em; }

/* The pattern a frame belongs to, under what this one means. Quieter than the
   meaning above it: a reader wants 'inside' first and the grammar second. */
/* What a member is doing in the construction, beside its own headword. The
   dictionary's entry follows underneath and is often about a different sense
   of the word entirely — 里's entry is a unit of distance. */
.member-role {
    margin-left: .5rem;
    font-size: .8em;
    color: var(--accent);
    font-weight: normal;
}

.detail-note {
    margin: .4rem 0 0;
    font-size: .92em;
    line-height: 1.5;
    color: var(--muted);
}


/* Furigana on the back of a card. The sentence is flowing text rather than
   chips, so the line box has to make room for the marks or the lines above a
   kanji word sit tighter than the rest. Reserved on the paragraph rather than
   on the ruby, so the spacing is even whether or not a given line has any. */
.card-sentence { line-height: 2.1; }
.card-sentence ruby { ruby-position: over; ruby-align: center; }

.card-sentence rt {
    font-size: 0.55em;
    line-height: 1.1;
    color: var(--muted);
    font-weight: 400;
    /* Selecting the sentence should give the sentence, not the sentence with
       its readings interleaved. */
    user-select: none;
}

.card-sentence .word.target rt { color: inherit; opacity: 0.75; }

/* Furigana in flowing prose, which is not the same problem as furigana on a
   chip. A reading is often wider than the word it sits over — わたくし is four
   kana above one kanji — and the element widens to fit, pushing its neighbours
   apart. That reads as broken spacing in a language that has no spaces.
   Smaller marks and a reserved line box keep the text in one line of running
   prose rather than in islands. */
.reading .passage {
    line-height: 2.3;
}

.reading ruby {
    ruby-position: over;
    ruby-align: center;
}

.reading rt {
    font-size: 0.5em;
    line-height: 1.1;
    font-weight: 400;
    color: var(--muted);
    /* Selecting a paragraph should give the paragraph, not the paragraph with
       its readings spliced between the words. */
    user-select: none;
}

.word:hover rt { color: inherit; }

/* Touch -------------------------------------------------------------------
   Not "small screen": a phone and a laptop differ in what they can *do*, and
   the two questions have different answers. A tablet is wide and has no
   pointer; a small window on a desktop is narrow and has one. Everything here
   is about the absence of a pointer, and the widths are handled separately
   below.

   The site's main affordance is a hover: the token strip, the review card and
   a page of Latin all say "every word here is clickable" by underlining the
   lot when the pointer enters. A finger never enters anything, so on touch the
   cue is simply always on — which is the same promise, made where it can be
   kept. */
@media (hover: none) {
    .strip .chip,
    .card .word,
    .reading .word {
        text-decoration: underline dotted;
        text-decoration-thickness: 1px;
        text-decoration-color: var(--muted);
        text-underline-offset: .3em;
    }

    /* Drawn by the text decoration above instead, so the border does not
       double it. */
    .reading .word { border-bottom-color: transparent; }

    .strip .chip.active { text-decoration-color: var(--accent-2); }
    .strip .chip.selected { text-decoration-color: currentColor; }
    .card .word.target { text-decoration-color: var(--accent-2); }

    /* A tap is not a hover, and a hover style left on after a tap is a word
       that looks selected when it is not. */
    .chip:hover { background: transparent; border-color: transparent; }
    .chip.active:hover { background: var(--panel); border-color: var(--line); }
    .chip.selected:hover { background: var(--accent); border-color: var(--accent); }

    /* Everything that is pressed, at a size a thumb can hit. The visible mark
       stays where it was; what grows is the box around it. */
    .play { width: 2.4rem; height: 2.4rem; }
    h1.headword .play { width: 2.6rem; height: 2.6rem; }
    .play svg { width: 1.1rem; height: 1.1rem; }

    .analyse-sentence {
        width: 2.2rem;
        height: 2.2rem;
        vertical-align: -.6rem;
        /* No hover to reveal it with, so it is simply present. */
        opacity: .8;
    }

    .analyse-sentence svg { width: 1rem; height: 1rem; }

    /* The mark stays the size it was and the box around it becomes a target;
       centred, or the glyph sits in the corner of its own hit area and the
       two look like different controls. */
    .panel-close,
    .modal-dismiss button,
    .upgrade-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 2.75rem;
        min-height: 2.75rem;
        padding: 0;
    }

    .panel-close,
    .upgrade-close { top: .1rem; right: .1rem; }

    /* Clear of the target rather than of the glyph. */
    .panel-word { padding-right: 2.75rem; }

    .chip { padding: .45rem .5rem; }

    .suggestions a { padding: .6rem .5rem; }

    /* Fifty names set to be scanned, which on a phone also have to be hit. */
    .author-index { gap: .35rem .9rem; line-height: 1.9; }

    .footer-links { gap: 1rem 1.25rem; line-height: 2.2; }

    .shelf-works li { padding: .4rem 0; }

    .lang-option { padding: .5rem .6rem; }

    /* There is no keyboard to press, so the keys are noise on the one screen
       with the least room for any. */
    .grade-key { display: none; }

    /* Hover is what opens it on a pointer; a tap sets `tune-open` instead, and
       the hover rule firing on the tap as well would make it a thing you
       cannot shut. */
    .tune:hover .tune-tip,
    .tune:focus-within .tune-tip { opacity: 0; visibility: hidden; }
    .tune-open .tune-tip { opacity: 1; visibility: visible; }
}

/* Narrow ------------------------------------------------------------------
   The widths, which are a separate question from the pointer: a desktop
   window dragged narrow gets these and not the rules above. */
@media (max-width: 34rem) {
    /* Two rows, the box on its own. One row gives the input 147px on a 390px
       phone, which is four characters of a sentence somebody pasted. The
       suggestion list hangs off `.search-field`, so it still opens under the
       words being typed rather than under the button. */
    .search { flex-wrap: wrap; }
    .search-field { flex: 1 1 100%; order: -1; }
    .search select { flex: 1 1 auto; }
    .search button { flex: none; }

    h1.headword { font-size: 1.9rem; }

    /* A German compound or a long Latin headword is wider than a phone, and a
       heading is the one place on the page with nothing to wrap at. */
    h1.headword,
    .unread-title,
    .panel-word,
    .detail-head { overflow-wrap: anywhere; }

    .unread-title { font-size: 1.5rem; }

    /* 10rem of label against 358px of page leaves the value in a column two
       words wide. */
    table.morph th { width: 7rem; padding-left: 0; }
    table.morph td { padding-right: 0; }

    /* The gloss is the answer to a reverse lookup, and on one line beside the
       headword there is room for about half of it — "to gobble down, wolf
       down (to eat …" is the question asked back. Its own line, wrapping. */
    .matches li { flex-wrap: wrap; }
    .match-definition { flex: 1 1 100%; white-space: normal; }

    /* One card, the width of the page. The 20rem ceiling keeps a lone card
       from stretching across a laptop, and on a phone it leaves a column of
       air beside the card while the readings inside it wrap three deep. */
    .kanji-cards { grid-template-columns: 1fr; }

    .detail { padding: .85rem .9rem; }
    .card { padding: 1.1rem 1rem .9rem; }

    /* The two doors stack rather than squeezing onto one line. */
    .unread-actions { flex-wrap: wrap; }

    .deck-section-row { flex-wrap: wrap; gap: .5rem; }
    .deck-create { margin-left: auto; }

    /* A dialog on a phone is a sheet: full width, off the bottom edge, and
       never taller than the window it opens over. Centred and inset, it
       wastes a gutter on each side of content that is already cramped — and
       its own scrollbar then sits inside that. The strip of backdrop left
       above it is what a tap dismisses it with. */
    dialog.modal[open],
    dialog.builder[open],
    dialog.upgrade[open] {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        margin: auto auto 0;
        padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
        border-width: 1px 0 0;
        border-radius: .9rem .9rem 0 0;
        /* Flex rather than block, so the close button below can be sticky:
           a float cannot be, and the button scrolling away leaves a long
           conjugation table with no visible way out. */
        display: flex;
        flex-direction: column;
    }

    /* A strip rather than a floating glyph: sticky over a conjugation table,
       a bare × sits in the middle of the forms scrolling past it and reads as
       part of them. Full width and opaque, so the content goes under it.

       `top` matches the negative margin below rather than being nought, and
       both halves of that are visible without it. The margin pulls the strip
       up through the sheet's own padding while a sticky offset of nought pins
       it *under* that padding, so the strip painted 15px lower than it was
       laid out: at rest the title underneath was laid out from the flow
       position and its top sat behind the opaque strip, clipping the first
       line of every modal on a phone, and once scrolled there was a band of
       sheet above the strip for the content to show through. */
    dialog.modal[open] .modal-dismiss {
        position: sticky;
        top: -1rem;
        z-index: 2;
        float: none;
        display: flex;
        justify-content: flex-end;
        align-self: stretch;
        margin: -1rem -1rem .2rem;
        padding: .2rem .35rem;
        background: var(--panel);
    }

    /* Absolutely positioned rather than in the flow, so it stays in the
       sheet's corner once the sheet is a flex column. */
    dialog.upgrade[open] .upgrade-close { top: .2rem; right: .4rem; }

    .modal-title { font-size: 1.2rem; }

    /* The sheet is already the width of the screen; a second gutter inside it
       is a column of air. */
    .exporter { width: 100%; }
    .export-limits { padding: .7rem .8rem; }

    .builder-actions { gap: .5rem; }
    .builder-cancel,
    .builder-danger,
    .builder-save { flex: 1; }

    /* Every control a thumb types into, at 16px or larger. Safari zooms the
       whole page in on a focused field set any smaller, and then leaves it
       zoomed — which on this form means the Save button is off the right of
       the screen the moment you name a deck. */
    .builder-field select,
    .builder-field textarea,
    .builder-field input { font-size: 1rem; padding: .6rem .6rem; }

    .word-panel {
        width: calc(100% - 1rem);
        bottom: max(.5rem, env(safe-area-inset-bottom));
        padding: .8rem .9rem;
    }

    /* Room above the panel for the line being read about. */
    .reading { padding-bottom: 55dvh; }

    .pager { font-size: .8rem; }

    /* The ad is as wide as the page and the page is 358px; a reserved 100px
       band plus a label is a quarter of the screen before anything arrives. */
    .ad-slot.ad-live { min-height: 90px; }
}

/* A set of choices in the deck builder ------------------------------------
   Checkboxes rather than a <select multiple>, which needs a modifier key
   nobody discovers and gives a phone no sign that more than one may be
   picked. Scrolls at eleven conjugations rather than growing the sheet past
   the window. */
.choices {
    display: grid;
    gap: .1rem;
    max-height: 13rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: .4rem;
    background: var(--bg);
}

/* Two columns where the labels are short and there are many of them. */
.choices-split { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }

.choice {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .4rem;
    border-radius: .3rem;
    font-size: .9rem;
    line-height: 1.3;
    cursor: pointer;
}

.choice:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

.choice input {
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--accent-2);
    cursor: pointer;
}

.choice:has(input:focus-visible) { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* How many are ticked, beside the label: the box scrolls, so the count is the
   only way to see at a glance that something further down is on. */
.builder-chosen {
    margin-left: .45rem;
    font-style: normal;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted);
}

@media (hover: none) {
    /* A thumb, and a box tall enough that the scroll is obvious. */
    .choice { padding: .6rem .4rem; }
    .choices { max-height: 15rem; }
    .choice input { width: 1.15rem; height: 1.15rem; }
}

/* Why an export is smaller than the number of words asked for. Quieter than
   the count above it: it is a fact about the deck rather than a warning. */
.export-short {
    display: inline-block;
    margin-top: .3rem;
    font-size: .82rem;
    color: var(--muted);
}

.export-short strong { color: var(--ink); font-weight: 600; }
