/* Treasurer. One stylesheet, no build step, phone width first.
   Desktop is the media query at the bottom, not the other way round. */

:root {
    --bg:          #f2f3f5;
    --surface:     #ffffff;
    --surface-2:   #f7f8fa;
    --border:      #d7dae0;
    --text:        #17191d;
    --text-muted:  #5c6270;
    --accent:      #1e5fa8;
    --accent-text: #ffffff;
    --danger:      #b3261e;
    --danger-bg:   #fdecea;
    --success:     #1c6b3f;
    --success-bg:  #e7f4ec;
    --warning:     #8a5a00;
    --warning-bg:  #fdf3e0;
    --radius:      12px;
    --tap:         44px;          /* nothing tappable is smaller than this */
    --gap:         12px;
}

/* Light only. One theme is one fewer thing to check on a phone. */

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

/* A component rule with equal or higher specificity than the UA [hidden]
   rule (e.g. a flex row's display: flex) otherwise wins the cascade on
   source order alone, leaving a "hidden" row on screen. This keeps
   [hidden] authoritative everywhere, picker rows included. */
[hidden] { display: none !important; }

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.125rem; margin: 20px 0 8px; }
h3 { font-size: 1rem; margin: 1em 0 .3em; }
p  { margin: 0 0 .8em; }
a  { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.muted    { color: var(--text-muted); }
.hint     { color: var(--text-muted); font-size: .85rem; margin: .3em 0 0; }
.small    { font-size: .85rem; }
.centre   { text-align: center; }
.nowrap   { white-space: nowrap; }
.stack > * + * { margin-top: var(--gap); }
.mt { margin-top: 12px; }

/* ------------------------------------------------------------ structure */

.page {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 12px calc(72px + env(safe-area-inset-bottom));
}
.page--bare { padding-bottom: 24px; display: flex; min-height: 90vh; align-items: center; }
.body--bare { background: var(--bg); }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: var(--tap);
    padding: 4px 12px;
    padding-top: calc(4px + env(safe-area-inset-top));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar__title { font-weight: 600; }
.topbar__back  { font-weight: 600; text-decoration: none; padding: 10px 0; min-height: var(--tap); display: flex; align-items: center; }
.topbar__out   { margin: 0; }

.linkbutton {
    background: none; border: 0; color: var(--accent);
    font: inherit; font-size: .9rem; cursor: pointer;
    min-height: var(--tap); padding: 0 4px;
}

/* Bottom navigation: five tabs, fixed, thumb-reachable. No hamburger. */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}
.tabbar__tab {
    flex: 1 1 0;
    min-height: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: .7rem;
}
.tabbar__tab svg { fill: currentColor; }
.tabbar__tab.is-active { color: var(--accent); font-weight: 600; }

.icon { width: 1.25em; height: 1.25em; vertical-align: -0.3em; flex: none; }
.tabbar__tab .icon { width: 26px; height: 26px; }
.btn .icon { margin-right: 6px; }
.btn--icon { width: var(--tap); padding: 0; justify-content: center; }
.btn--icon .icon { margin: 0; }

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: var(--gap);
}
.card--auth { width: 100%; max-width: 420px; margin: 0 auto; }
.card--flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: var(--gap); }
.brand { font-size: 1.1rem; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; }

.section-title {
    font-size: 1.125rem; margin: 20px 0 8px;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
}

/* --------------------------------------------------------------- totals */

.tiles { display: flex; gap: 8px; margin-top: var(--gap); }
.tile {
    flex: 1 1 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 8px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}
.tile__value { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile__label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.tile--danger .tile__value { color: var(--danger); }
.tile--warn .tile__value { color: var(--warning); }

.claims-banner { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: inherit; margin-top: 12px; min-height: var(--tap); }

/* ---------------------------------------------------------------- lists */

.list { list-style: none; margin: var(--gap) 0 0; padding: 0; background: var(--surface);
        border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list__item + .list__item { border-top: 1px solid var(--border); }
.list__link {
    display: flex; align-items: center; gap: 10px;
    min-height: var(--tap); padding: 10px 12px;
    text-decoration: none; color: inherit;
}
.list__link:active { background: var(--surface-2); }
.list__main { flex: 1 1 auto; min-width: 0; }
/* Block, not inline: two inline spans refuse to wrap between themselves and
   push the whole document wider than a phone screen. */
.list__title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.list__sub   { display: block; font-size: .85rem; color: var(--text-muted); overflow-wrap: anywhere; }
.list__side { text-align: right; flex: 0 0 auto; }
.list__chevron { color: var(--text-muted); flex: 0 0 auto; }

/* Money is right-aligned and tabular so columns of digits line up. */
.money { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.money--owed { color: var(--danger); }

.empty { padding: 24px 12px; text-align: center; color: var(--text-muted); }
.owes { font-weight: 600; font-variant-numeric: tabular-nums; }
.owes--due { color: var(--danger); }

/* Visible to screen readers, invisible on screen. Used for labels the layout
   already makes obvious but assistive technology still needs. */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --------------------------------------------------------------- badges */

.badge {
    display: inline-block; font-size: .68rem; font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase;
    padding: 2px 6px; border-radius: 5px; white-space: nowrap;
    background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border);
}
.badge--paid   { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge--part   { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge--said   { background: var(--warning-bg); color: var(--warning); }
.badge--unpaid { background: var(--surface-2);  color: var(--text-muted); }
.badge--waived { background: var(--surface-2);  color: var(--text-muted); font-style: italic; }
.badge--late   { background: var(--danger-bg);  color: var(--danger); border-color: transparent; }
.badge--draft  { background: var(--warning-bg); color: var(--warning); border-color: transparent; }

/* A glyph stands in for a badge word in a list row: state at a glance,
   the word still there for anyone who taps or reads with a screen reader. */
.glyph { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; }
.glyph .icon { width: 16px; height: 16px; }
.glyph--paid    { color: var(--success); background: var(--success-bg); }
.glyph--part,
.glyph--said    { color: var(--warning); background: var(--warning-bg); }
.glyph--unpaid,
.glyph--draft   { color: var(--text-muted); background: var(--surface-2); }
.glyph--waived,
.glyph--declined { color: var(--text-muted); background: var(--surface-2); }
.glyph--late    { color: var(--danger); background: var(--danger-bg); }
.badge .icon { width: 12px; height: 12px; margin-right: 4px; vertical-align: -2px; }
.empty .icon { display: block; width: 32px; height: 32px; margin: 0 auto 8px; color: var(--text-muted); }

/* -------------------------------------------------------------- buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: var(--tap); padding: 10px 16px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:active { background: var(--surface-2); }
.btn--primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn--danger  { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn--block   { width: 100%; }
.btn--small   { min-height: 36px; padding: 6px 10px; font-size: .85rem; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .4; pointer-events: none; }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 auto; }
.btn-row--tight > * { flex: 0 0 auto; }

/* The five tap-to-contact buttons: a consistent grid you can hit without looking. */
.channels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 12px 0; }
.channel {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 64px; padding: 6px 2px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    text-decoration: none; font-size: .68rem; text-align: center;
}
.channel svg { width: 22px; height: 22px; fill: currentColor; }
.channel[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* --------------------------------------------------------------- forms */

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field--check label { font-weight: 400; }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], input[type=number], input[type=search], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    /* 16px minimum, or iOS Safari zooms the page when a field is focused. */
    font: inherit;
    font-size: 16px;
}
textarea { min-height: 110px; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 4px; }
input[aria-invalid="true"] { border-color: var(--danger); }

/* A receipt photo, and a payee picked with no bank details on file yet. */
.receipt { display: block; max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.picker-option--nobank { color: var(--text-muted); }
.availability { min-height: 1.2em; font-size: .85rem; margin: .3em 0 0; }
.availability--ok { color: var(--success); }
.availability--no { color: var(--danger); }

.bigpass {
    font: 600 1.6rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .04em; text-align: center; padding: 16px;
    background: var(--surface-2); border-radius: var(--radius); user-select: all;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip {
    display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface); color: var(--text); text-decoration: none; font-size: .85rem;
}
.chip.is-active { background: var(--accent); color: var(--accent-text); border-color: transparent; font-weight: 600; }

/* --------------------------------------------------------------- flash */

.flash { padding: 10px 12px; border-radius: var(--radius); margin-bottom: var(--gap); font-size: .92rem; }
.flash--ok     { background: var(--success-bg); color: var(--success); }
.flash--error  { background: var(--danger-bg);  color: var(--danger); }
.flash--warn   { background: var(--warning-bg); color: var(--warning); }

/* --------------------------------------------------------------- tables */

/* Line items scroll sideways on a narrow phone rather than wrapping into mush. */
.scroller { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.grid { width: 100%; border-collapse: collapse; min-width: 420px; }
table.grid th, table.grid td { padding: 6px 6px; text-align: left; font-size: .9rem; border-bottom: 1px solid var(--border); }
table.grid th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid input { min-height: 40px; padding: 6px 8px; }

.itemlist { list-style: none; margin: 0; padding: 0; }
.itemlist li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .92rem; }
.itemlist .desc { flex: 1 1 auto; }
.itemlist .when { flex: 0 0 auto; color: var(--text-muted); width: 5.5em; }
.total-row { display: flex; justify-content: space-between; padding-top: 10px; font-weight: 700; }

/* ------------------------------------------------------------- messages */

.msg { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; background: var(--surface); }
.msg--draft { border-style: dashed; border-color: var(--warning); }
.msg__head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); margin-bottom: 6px; }
.msg__body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.msg__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.brief { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
         font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border);
         border-radius: var(--radius); padding: 12px; overflow-x: auto; }

/* The send list rows: name and amount, state underneath, and the icon actions
   that apply (usually two, sometimes more once a said-paid badge joins them).
   flex-wrap lets the actions drop to a row of their own rather than crushing
   the name into a single vertical strip of letters when there is not room
   for everything on one line. */
.send-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; min-height: 56px; }
.send-row + .send-row { border-top: 1px solid var(--border); }
.send-row__main { flex: 1 1 auto; min-width: 55%; }
/* The name is a link, but the whole row is already the visual target, so it
   does not need to shout in link blue. */
.send-row__main .list__title { color: inherit; text-decoration: none; }
.send-row__actions { display: flex; gap: 6px; flex: 0 0 auto; margin-left: auto; }
.iconbtn {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap);
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text); cursor: pointer;
}
.iconbtn svg { width: 20px; height: 20px; fill: currentColor; }
.iconbtn[aria-disabled="true"], .iconbtn:disabled { opacity: .35; pointer-events: none; }
.iconbtn--go { color: var(--accent); }
.iconbtn--tick { color: var(--success); }
/* Marks a message sent, or records a chase. Deliberately not the same green as
   the paid tick: telling somebody is not the same as being paid. */
.iconbtn--said { color: var(--muted); }

/* Add a Messenger handle in place, wherever a send action would otherwise be a
   dead end. Sits inside a send row, so it has to stay small and not push the
   amount or the ticks off a phone screen. */
.handle-form { display: flex; gap: 6px; align-items: center; flex: 0 1 auto; min-width: 0; }
.handle-form__input {
    width: 100%; max-width: 190px; min-width: 0;
    padding: 6px 8px; font-size: .9rem;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
}
.send-block .handle-form { margin-top: 6px; }
.send-block .handle-form__input { max-width: 320px; }

/* The £ menu on a send-list row: they say they've paid, or it landed in the
   bank. A small dropdown rather than a third icon, so the row stays scannable. */
.paysheet { position: relative; }
.paysheet > summary {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap);
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--success); font-weight: 700;
    cursor: pointer; list-style: none;
}
.paysheet > summary::-webkit-details-marker { display: none; }
.paysheet__body {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
    display: flex; flex-direction: column; gap: 8px;
    min-width: 220px; padding: 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.paysheet__body a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: var(--tap); text-align: center; font-size: .9rem;
}

/* Screen 2 of the ask builder: a checkbox and an amount, side by side. The
   input.ask-people__amount selector (not just .ask-people__amount) matches
   the specificity of the input[type=text] rule above, whose own width: 100%
   would otherwise win on source order and squeeze the name down to nothing. */
.ask-people .list__link { flex: 1 1 auto; min-width: 0; }
.ask-people .list__item { display: flex; align-items: center; gap: 8px; padding-right: 10px; }
input.ask-people__amount {
    width: 90px; min-width: 0; flex: 0 0 auto;
    text-align: right; font-variant-numeric: tabular-nums;
}
.ask-people__amount:disabled { opacity: .4; }

/* The message you came to send, first thing on the request screen. */
.send-block .msg__body { margin-top: 6px; }

.copyfallback { margin-top: 8px; }
.copyfallback textarea { font-size: 14px; min-height: 140px; }

/* ---------------------------------------------------------------- picker */

/* The native select this replaces: kept in the document (never display:none)
   so it still submits and still works with JS off, just off-screen. */
.picker__native { position: absolute; left: -9999px; }
.picker__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.picker__chip { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 2px 6px 2px 2px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); }
.picker__chip .avatar { width: 28px; height: 28px; font-size: 12px; }
/* input.picker__amount, not just .picker__amount: matches the specificity
   of the input[type=text] rule above, whose own width: 100% would otherwise
   win on source order and stretch every ticked person into a full-width bar. */
input.picker__amount { width: 5.5em; flex: none; min-height: var(--tap); padding: 6px 8px; }
.picker__remove { width: var(--tap); height: var(--tap); flex: none; border: 0; background: none; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; }
.picker__open { width: 100%; justify-content: flex-start; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: hsl(var(--hue) 45% 45%); color: #fff; font-weight: 600; font-size: 14px; flex: none; }
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.is-open { display: block; }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(23, 25, 29, .45); }
.sheet__panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 85vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; transform: translateY(100%); transition: transform .25s ease-out; }
.sheet.is-open .sheet__panel { transform: none; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sheet__head h2 { margin: 0; font-size: 1.05rem; }
/* The multi picker's tag chips (and their hint) move in here, above the
   search field: outside .sheet__body they've lost the .card padding that
   used to inset them, so they need their own. */
.sheet__panel > .filters { margin: 10px 16px 0; }
.sheet__panel > .hint { margin: 4px 16px 0; }
.sheet__search { padding: 8px 16px; }
.sheet__body { overflow: auto; padding: 0 0 env(safe-area-inset-bottom); }
.sheet__section { padding: 8px 16px 4px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.sheet__row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 6px 16px; border: 0; border-top: 1px solid var(--border); background: none; text-align: left; font: inherit; color: inherit; }
.sheet__row--nobank { opacity: .6; }
.sheet__row input[type=checkbox] { width: 22px; height: 22px; margin-left: auto; }
.sheet__row .ask-people__amount { display: none; }
body.sheet-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .sheet__panel { transition: none; } }
@media (min-width: 700px) { .sheet__panel { left: 50%; right: auto; width: 480px; transform: translate(-50%, 100%); } .sheet.is-open .sheet__panel { transform: translate(-50%, 0); } }

/* --------------------------------------------------------------- welcome */

.steps { position: relative; scroll-margin-top: 56px; }
.step { display: none; }
.step.is-active { display: block; animation: step-in .25s ease; }
.step:focus { outline: none; }
@keyframes step-in {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .step.is-active { animation: none; }
}
.step__footer { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 16px; }
.js-step-next { margin-left: auto; }
.platform + .platform { margin-top: 12px; }

/* -------------------------------------------------------------- progress */

.progress { display: flex; justify-content: center; gap: 24px; list-style: none; margin: 0 0 16px; padding: 0; }
.progress__step { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.progress__dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--text-muted); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; }
.progress__dot .icon { width: 14px; height: 14px; }
.progress__step.is-done .progress__dot { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.progress__step.is-current { color: var(--text); font-weight: 600; }
.progress__step.is-current .progress__dot { border-color: var(--accent); background: var(--accent); }
.claim-start { text-align: center; }
.claim-start .flash { text-align: left; }
/* .empty .icon already sets 32px; the extra .empty here raises specificity
   so this 48px wins regardless of the two rules' order in the sheet. */
.claim-start .empty .icon { width: 48px; height: 48px; color: var(--accent); }

/* --------------------------------------------------------------- reading */

.reading { text-align: center; padding: 32px 0; position: relative; }
.reading__art { width: 120px; height: 140px; }
.reading__paper { fill: var(--surface); stroke: var(--border); stroke-width: 2; }
.reading__line { stroke: var(--border); stroke-width: 4; stroke-linecap: round; }
.reading__beam { fill: var(--accent); animation: reading-beam 1.6s ease-in-out infinite alternate; }
@keyframes reading-beam {
    from { transform: translateY(0); }
    to   { transform: translateY(100px); }
}
.reading__title { margin-top: 16px; }
/* Hidden off to the side rather than display:none, so the fallback below can
   bring it back with a plain, numeric property every browser can animate —
   no reliance on discrete (keyword) animation of display or position, which
   is newer and not something a receipt scan reached from Messenger's in-app
   browser can safely assume. The JS reveal (20s) and the no-JS <noscript>
   below both move it back the same way, so all three fallbacks agree.
   reading-reveal is JS's last resort too: if JS starts but then stalls
   (rather than being absent outright, which <noscript> already covers), the
   button still appears on its own after 25s. Working JS cancels it and
   reveals at the usual 20s instead. */
.reading__form { position: absolute; left: -9999px; width: 100%; animation: reading-reveal 0s 25s forwards; }
@keyframes reading-reveal {
    to { left: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .reading__beam { animation: none; transform: translateY(50px); }
}

/* ---------------------------------------------------------------- print */

@media print {
    .topbar, .tabbar, .btn, .btn-row, form { display: none !important; }
    body { background: #fff; color: #000; }
    .page { padding: 0; max-width: none; }
    .card { border: 0; padding: 0; }
}

/* -------------------------------------------------------------- desktop */

/* Desktop is the secondary case: same layout, more room. The navigation stays
   at the bottom, because two different navigation patterns is two things to
   learn and the phone is the primary device. */
@media (min-width: 700px) {
    .page { padding: 20px 20px 90px; }
    .channels { grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: start; }
    .tabbar { max-width: 720px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
    .tabbar__tab { font-size: .78rem; }
    .btn-row > * { flex: 0 1 auto; }
}

/* ------------------------------------------------ the install guide phones */
.phone-guide { margin: 8px 0 0; text-align: center; }
.phone-guide figcaption { margin-top: 8px; color: var(--text-muted); }
.phone { width: 160px; height: 240px; }
.phone__body { fill: var(--text); }
.phone__screen { fill: var(--bg); }
.phone__app { fill: var(--border); }
.phone__paper { fill: var(--surface); }
.phone__line { fill: var(--border); }
.phone__bar { fill: var(--surface-2); }
.phone__pill { fill: var(--border); }
.phone__share, .phone__menu, .phone__row-plus, .phone__newicon-mark { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.phone__menu { stroke: var(--text); stroke-width: 3; }
.phone__sheet-bg { fill: var(--surface); stroke: var(--border); }
.phone__grabber { fill: var(--border); }
.phone__row { fill: var(--surface-2); }
.phone__row--target { fill: var(--surface); stroke: var(--accent); }
.phone__row-icon { fill: var(--accent); }
.phone__text { font-size: 9px; fill: var(--text); font-family: inherit; }
.phone__text--light { fill: var(--accent-text); }
.phone__button { fill: var(--accent); }
.phone__newicon-box { fill: var(--accent); }
.phone__newicon-mark { stroke: var(--accent-text); }
.phone__label { font-size: 8px; fill: var(--text); font-family: inherit; }
.phone__tap { fill: var(--accent); opacity: 0; transform-box: fill-box; transform-origin: center; }

/* Eight-second loop. Percentages are seconds × 12.5. */
.phone__page    { animation: phone-page 8s infinite; }
.phone__sheet   { animation: phone-sheet 8s infinite; transform: translateY(150px); }
.phone__newicon { animation: phone-newicon 8s infinite; opacity: 0; }
.phone__tap--share, .phone__tap--menu { animation: phone-tap-1 8s infinite; }
.phone__tap--add, .phone__tap--install { animation: phone-tap-2 8s infinite; }
.phone--android .phone__sheet { animation-name: phone-menu; transform: none; opacity: 0; }
.phone--android .phone__dialog { animation: phone-dialog 8s infinite; opacity: 0; }
.phone__tap--confirm { animation: phone-tap-3 8s infinite; }

@keyframes phone-page    { 0%, 62% { opacity: 1; } 68%, 96% { opacity: 0; } 100% { opacity: 1; } }
@keyframes phone-sheet   { 0%, 22% { transform: translateY(150px); } 30%, 58% { transform: translateY(0); } 64%, 100% { transform: translateY(150px); } }
@keyframes phone-menu    { 0%, 22% { opacity: 0; } 25%, 44% { opacity: 1; } 46%, 100% { opacity: 0; } }
@keyframes phone-dialog  { 0%, 46% { opacity: 0; } 48%, 62% { opacity: 1; } 64%, 100% { opacity: 0; } }
@keyframes phone-newicon { 0%, 66% { opacity: 0; } 72%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes phone-tap-1   { 0%, 12% { opacity: 0; transform: scale(.4); } 15% { opacity: .6; transform: scale(1); } 20%, 100% { opacity: 0; transform: scale(1.3); } }
@keyframes phone-tap-2   { 0%, 46% { opacity: 0; transform: scale(.4); } 49% { opacity: .6; transform: scale(1); } 54%, 100% { opacity: 0; transform: scale(1.3); } }
@keyframes phone-tap-3   { 0%, 56% { opacity: 0; transform: scale(.4); } 58% { opacity: .6; transform: scale(1); } 62%, 100% { opacity: 0; transform: scale(1.3); } }

@media (prefers-reduced-motion: reduce) {
    .phone__page, .phone__sheet, .phone__newicon, .phone__dialog, .phone__tap,
    .phone--android .phone__sheet, .phone--android .phone__dialog { animation: none; }
    .phone__page { opacity: 0; }
    .phone__sheet, .phone__dialog { opacity: 0; transform: translateY(150px); }
    .phone__newicon { opacity: 1; }
}
