/* RareWatch shell: top bar, tab bar, account menu, theme picker, alerts popover, command palette, footer, state boxes, banners.
   Tokens only. Loaded after social.css, so rules for the bar are written with enough weight to replace the older ones. */

:root { --tab-h: 56px; } /* height of the phone tab bar (the safe-area inset is added on top) */

/* ---------- accessibility basics ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: var(--s-3); top: -80px; z-index: 200; padding: var(--s-2) var(--s-4); border-radius: var(--r-md); background: var(--accent); color: var(--on-accent); font-weight: 650; transition: top var(--fast) var(--ease); }
.skip:focus { top: calc(var(--s-2) + env(safe-area-inset-top, 0px)); }
#app:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
header.nav :focus-visible, .mtabs :focus-visible, .cpal :focus-visible, .acpop :focus-visible, .alpop :focus-visible { outline-offset: -2px; }
kbd { display: inline-block; font: 600 var(--t-xs)/18px var(--font-body); color: var(--mute); background: var(--surface-2); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-xs); padding: 0 var(--s-2); }
.ml { margin-left: auto; }

/* ---------- route progress ---------- */
.rbar { position: fixed; left: 0; top: 0; height: 2px; width: 100%; z-index: calc(var(--z-toast) + 1); pointer-events: none; transform-origin: left; transform: scaleX(0); opacity: 0; background: var(--accent); }
.rbar.run { opacity: 1; animation: rbar 5s cubic-bezier(.1, .8, .2, 1) forwards; }
.rbar.done { opacity: 0; transform: scaleX(1); transition: transform var(--med) ease, opacity .35s ease .15s; }
@keyframes rbar { 0% { transform: scaleX(0); } 100% { transform: scaleX(.92); } }

/* ---------- announcement banner (announce.js) ---------- */
.rw-ann { --ann: var(--info); position: relative; z-index: 5; display: flex; align-items: center; justify-content: center; gap: var(--s-3); padding: var(--s-2) var(--gutter);
  font: 550 var(--t-sm)/var(--lh-snug) var(--font-body); color: var(--text-strong); background: color-mix(in srgb, var(--ann) 16%, var(--bg)); border-bottom: 1px solid color-mix(in srgb, var(--ann) 40%, transparent); }
.rw-ann.good { --ann: var(--good); } .rw-ann.warn { --ann: var(--warn); } .rw-ann.bad { --ann: var(--bad); }
.rw-ann .at { min-width: 0; text-align: center; overflow-wrap: anywhere; }
.rw-ann a { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.rw-ann button { flex: none; width: var(--ctl-sm); height: var(--ctl-sm); display: grid; place-items: center; border-radius: var(--r-sm); border: 0; background: none; color: var(--mute); font-size: var(--t-md); line-height: 1; cursor: pointer; }
.rw-ann button:hover { background: var(--hover); color: var(--text-strong); }

/* ---------- offline bar ---------- */
.netbar { position: fixed; z-index: calc(var(--z-toast) - 1); left: 50%; bottom: var(--s-5); transform: translateX(-50%); max-width: min(560px, calc(100vw - 2 * var(--gutter))); width: max-content;
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--bad) 14%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); color: var(--text-strong); box-shadow: var(--shadow-2); }
.netbar .ic { color: var(--bad); flex: none; }
.netbar span { font-size: var(--t-sm); }
.netx { background: none; border: 0; color: var(--mute); width: var(--ctl-sm); height: var(--ctl-sm); border-radius: var(--r-sm); display: grid; place-items: center; }
.netx:hover { background: var(--hover); color: var(--text-strong); }

/* ---------- state boxes ---------- */
.statebox { text-align: center; padding: var(--s-7) var(--s-4); max-width: 460px; margin: 0 auto; }
.statebox .sbicon { width: 56px; height: 56px; margin: 0 auto var(--s-4); border-radius: var(--r-pill); display: grid; place-items: center; color: var(--mute); background: var(--surface-2); border: 1px solid var(--line); }
.statebox.bad .sbicon { color: var(--bad); background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.statebox h3 { margin: 0 0 var(--s-1); font: 650 var(--t-lg)/var(--lh-snug) var(--font-display); color: var(--text-strong); }
.statebox p { margin: 0 auto var(--s-4); color: var(--mute); max-width: 36ch; }
.sbact { display: flex; gap: var(--s-2); justify-content: center; flex-wrap: wrap; }
.apbody .statebox, .cp-list .statebox { padding: var(--s-6) var(--s-3); }

/* ---------- top bar ---------- */
header.nav { position: sticky; top: 0; z-index: var(--z-nav); display: block; gap: 0; padding: env(safe-area-inset-top, 0px) 0 0; height: auto;
  background: var(--nav-bg); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border: 0; border-bottom: 1px solid var(--line); box-shadow: none; transition: none; }
header.nav .navin { position: relative; display: flex; align-items: center; flex-wrap: nowrap; gap: var(--s-4); height: var(--nav-h); max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
header.nav .logo { display: flex; align-items: center; gap: var(--s-2); margin: 0; flex: none; color: var(--text-strong); font: 700 var(--t-md)/1 var(--font-display); font-stretch: 85%; letter-spacing: -.01em; }
header.nav .logo img, .fbrand .logo img { width: 30px; height: 30px; transform: none; transition: none; }
.logo b { background: none; -webkit-background-clip: border-box; background-clip: border-box; -webkit-text-fill-color: currentColor; color: inherit; font-weight: 800; }
.logo span { display: inline; }
header.nav .navlinks { display: flex; align-items: stretch; gap: var(--s-1); height: 100%; margin-left: var(--s-3); }
header.nav .nl { position: relative; display: inline-flex; align-items: center; gap: var(--s-1); height: 100%; padding: 0 var(--s-3); border-radius: 0; background: none;
  color: var(--mute); font: 550 var(--t-base)/1 var(--font-body); white-space: nowrap; transition: color var(--fast); }
header.nav .nl:hover { color: var(--text-strong); background: none; }
header.nav .nl.on { color: var(--text-strong); background: none; }
header.nav .nl::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: 0; box-shadow: none; transition: opacity var(--fast); }
header.nav .nl.on::after { opacity: 1; }
.nbadge { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font: 700 11px/18px var(--font-body); text-align: center; }

header.nav .navsearch { order: 0; flex: 0 1 340px; width: auto; max-width: 340px; min-width: 0; height: 38px; margin: 0 0 0 auto; padding: 0 var(--s-3); display: flex; align-items: center; gap: var(--s-2);
  background: var(--field); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: none; color: var(--faint); font: 400 var(--t-sm)/1 var(--font-body); text-align: left; cursor: pointer; transition: border-color var(--fast), background var(--fast); }
header.nav .navsearch:hover { border-color: var(--line-strong); color: var(--mute); background: var(--field); }
header.nav .navsearch .ic { color: var(--mute); flex: none; }
.nstext { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nskbd { display: inline-flex; gap: 3px; flex: none; }
header.nav .navsearch kbd { display: inline-block; padding: 0 6px; background: none; border-width: 1px; font-size: 11px; line-height: 17px; }

header.nav .navright { display: flex; align-items: center; gap: var(--s-2); margin: 0; flex: none; }
.popanchor { position: relative; }
.bell, .tbtn { position: relative; display: grid; place-items: center; width: var(--ctl); height: var(--ctl); padding: 0; border: 0; border-radius: var(--r-md); background: none; color: var(--mute); transition: background var(--fast), color var(--fast); }
.bell:hover, .tbtn:hover { background: var(--hover); color: var(--text-strong); }
.bell[aria-expanded="true"], .tbtn[aria-expanded="true"] { background: var(--press); color: var(--text-strong); }
.bell .dot { position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font: 700 11px/17px var(--font-body); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
header.nav .lgn { display: inline-flex; }

.acbtn { display: flex; align-items: center; gap: var(--s-2); height: var(--ctl); padding: 0 var(--s-2) 0 var(--s-1); border-radius: var(--r-md); background: none; border: 1px solid var(--line); color: var(--text-strong); font: 600 var(--t-sm) var(--font-body); transition: background var(--fast), border-color var(--fast); }
.acbtn:hover, .acbtn[aria-expanded="true"] { background: var(--hover); border-color: var(--line-strong); }
.acbtn > .ic:last-child { display: block; color: var(--mute); }
.acav { width: 30px; height: 30px; border-radius: var(--r-pill); display: grid; place-items: center; flex: none; overflow: hidden; background: var(--surface-3); color: var(--accent); }
.acav.big { width: 44px; height: 44px; }
.acav > * { max-width: 100%; max-height: 100%; }
.acname { display: inline; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- popovers: account menu, appearance, alerts ---------- */
.acpop, .alpop { position: absolute; right: 0; top: calc(100% + var(--s-2)); z-index: var(--z-pop); background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-3); backdrop-filter: none; animation: popin var(--med) var(--ease) backwards; transform-origin: top right; }
@keyframes popin { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.acpop { width: 296px; padding: var(--s-2); display: flex; flex-direction: column; gap: var(--s-1); max-height: calc(100dvh - var(--nav-h) - var(--s-5)); overflow-y: auto; overscroll-behavior: contain; }
.acpop[hidden] { display: none; }
.achead { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-md); color: var(--text-strong); }
.achead:hover { background: var(--hover); }
.acwho { display: grid; min-width: 0; line-height: var(--lh-snug); }
.acwho b { font: 650 var(--t-md)/var(--lh-snug) var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acwho small { color: var(--mute); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acgrp { display: flex; flex-direction: column; gap: 2px; padding: var(--s-1) 0; border-top: 1px solid var(--line); }
.acitem { display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--ctl); padding: 0 var(--s-3); border: 0; border-radius: var(--r-md); background: none; color: var(--text); font: 500 var(--t-base) var(--font-body); text-align: left; cursor: pointer; }
.acitem .ic { color: var(--mute); flex: none; }
.acitem:hover, .acitem:focus-visible { background: var(--hover); color: var(--text-strong); }
.acitem:hover .ic, .acitem:focus-visible .ic { color: var(--accent); }
.acitem .ml { margin-left: auto; display: inline-flex; }
.apr { padding: var(--s-3); border-top: 1px solid var(--line); display: grid; gap: var(--s-3); }
.apr-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); font: 500 var(--t-base) var(--font-body); color: var(--text); }
.apr-cur { color: var(--mute); font-size: var(--t-sm); }
.apr-note { margin: calc(-1 * var(--s-1)) 0 0; color: var(--mute); font-size: var(--t-sm); }
.themepop { width: 284px; padding: 0; }
.themepop .apr { border-top: 0; }

/* theme picker (themePicker() in shell.js). Preview colours are theme data, set inline from RWTheme.list */
.rwtp { display: grid; gap: var(--s-3); }
.rwtp:not(.compact) { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.rwtp.compact { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tp-opt { position: relative; padding: 0; border: 0; background: none; color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.rwtp.compact .tp-opt { width: 28px; height: 28px; border-radius: var(--r-pill); }
.rwtp.compact .tp-prev { display: grid; place-items: center; width: 100%; height: 100%; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line-strong); }
.rwtp.compact .tp-dot { width: 10px; height: 10px; border-radius: var(--r-pill); }
.rwtp.compact .tp-opt.on { outline: 2px solid var(--accent); outline-offset: 2px; }
.rwtp:not(.compact) .tp-opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s-1) var(--s-2); padding: var(--s-2); border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); transition: border-color var(--fast), background var(--fast); }
.rwtp:not(.compact) .tp-opt:hover { border-color: var(--line-strong); background: var(--surface-3); }
.rwtp:not(.compact) .tp-opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rwtp:not(.compact) .tp-prev { grid-column: 1 / -1; position: relative; display: flex; align-items: center; justify-content: center; height: 56px; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.rwtp:not(.compact) .tp-card { display: flex; align-items: center; gap: var(--s-1); padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); box-shadow: 0 0 0 1px var(--line); }
.rwtp:not(.compact) .tp-card.bare { background: none; box-shadow: none; }
.rwtp:not(.compact) .tp-dot { width: 12px; height: 12px; border-radius: var(--r-pill); }
.tp-tx { display: grid; min-width: 0; line-height: var(--lh-snug); }
.tp-tx b { font: 600 var(--t-sm) var(--font-body); color: var(--text-strong); }
.tp-tx small { color: var(--mute); font-size: var(--t-xs); }
.rwtp:not(.compact) .tp-opt > .ic { color: var(--accent); opacity: 0; }
.rwtp:not(.compact) .tp-opt.on > .ic { opacity: 1; }

/* alerts */
.alpop { width: min(400px, calc(100vw - 2 * var(--gutter))); max-height: min(560px, 78vh); display: flex; flex-direction: column; overflow: hidden; }
.alpop:focus { outline: none; }
.aphead { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-3) var(--s-2) var(--s-4); }
.aphead b { font: 650 var(--t-md)/1 var(--font-display); color: var(--text-strong); }
.aplink { background: none; border: 0; color: var(--mute); width: var(--ctl-sm); height: var(--ctl-sm); border-radius: var(--r-sm); display: grid; place-items: center; }
.aplink:hover { color: var(--text-strong); background: var(--hover); }
.apbody { overflow-y: auto; padding: 0 var(--s-2) var(--s-2); overscroll-behavior: contain; }
.apskel { display: grid; gap: var(--s-2); padding: var(--s-1) var(--s-2); }
.apsk { height: 54px; border-radius: var(--r-md); background: var(--skeleton); }
.aph { font: 600 var(--t-sm) var(--font-body); color: var(--mute); padding: var(--s-3) var(--s-2) var(--s-1); }
.alrow { display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left; padding: var(--s-2); border-radius: var(--r-md); border: 0; background: none; color: inherit; position: relative; }
button.alrow { cursor: pointer; }
button.alrow:hover, button.alrow:focus-visible { background: var(--hover); }
.alrow.new::before { content: ""; position: absolute; left: 0; top: 50%; width: 3px; height: 24px; margin-top: -12px; border-radius: 2px; background: var(--accent); }
.alrow .mini { width: 38px; flex: none; }
.alav { width: 38px; height: 38px; flex: none; border-radius: var(--r-pill); display: grid; place-items: center; background: var(--surface-3); color: var(--accent); overflow: hidden; }
.altx { min-width: 0; flex: 1; display: grid; gap: 1px; line-height: var(--lh-snug); }
.altx b { color: var(--text-strong); font-weight: 600; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.altx small { color: var(--mute); font-size: var(--t-sm); }
.altx small.good { color: var(--good); } .altx small.bad { color: var(--bad); }
.altx small.when { color: var(--faint); font-size: var(--t-xs); }
.alacts { display: flex; gap: var(--s-2); flex: none; }
.apfoot { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-sm); color: var(--mute); }
.apfoot a:hover { color: var(--text-strong); }

/* ---------- command palette ---------- */
.cp-scrim { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; justify-content: center; align-items: flex-start; padding: max(10vh, env(safe-area-inset-top, 0px)) var(--s-4) var(--s-4);
  background: var(--scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: cpfade var(--med) ease backwards; }
@keyframes cpfade { from { opacity: 0; } }
.cpal { width: min(640px, 100%); max-height: min(620px, 80vh); display: flex; flex-direction: column; overflow: hidden; background: var(--surface-1); border: 1px solid var(--line-strong); border-radius: var(--r-xl); box-shadow: var(--shadow-3); animation: popin var(--med) var(--ease) backwards; }
.cp-top { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-3) 0 var(--s-4); height: 56px; border-bottom: 1px solid var(--line); color: var(--mute); flex: none; }
.cp-input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; box-shadow: none; font: 400 var(--t-md) var(--font-body); color: var(--text-strong); }
.cp-input:focus { box-shadow: none; }
.cp-input::placeholder { color: var(--faint); }
.cp-esc { font: 600 var(--t-xs) var(--font-body); color: var(--mute); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-xs); padding: var(--s-1) var(--s-2); }
.cp-esc:hover { color: var(--text-strong); }
.cp-list { overflow-y: auto; padding: var(--s-1) var(--s-2) var(--s-2); overscroll-behavior: contain; flex: 1; transition: opacity var(--fast); }
.cp-list.busy { opacity: .85; }
.cp-head { font: 600 var(--t-sm) var(--font-body); color: var(--mute); padding: var(--s-3) var(--s-3) var(--s-1); }
.cp-tip { margin: var(--s-3) var(--s-3) var(--s-1); color: var(--faint); font-size: var(--t-sm); }
.cp-row { position: relative; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-3); min-height: 48px; border-radius: var(--r-md); cursor: pointer; }
.cp-row.sel { background: var(--accent-soft); }
.cp-row.sel::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 2px; background: var(--accent); }
.cp-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: var(--r-sm); color: var(--mute); background: var(--surface-2); overflow: hidden; }
.cp-ico .mini { width: 36px; } .cp-ico .av, .cp-ico .avatar { margin: 0; }
.cp-row.sel .cp-ico { color: var(--accent); }
.cp-tx { flex: 1; min-width: 0; display: grid; line-height: var(--lh-snug); }
.cp-tx b { color: var(--text-strong); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-tx small { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-go { color: var(--mute); opacity: 0; flex: none; }
.cp-row.sel .cp-go { opacity: 1; }
.cp-extra { flex: none; }
.cp-tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); color: var(--mute); }
.cp-foot { display: flex; gap: var(--s-4); padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line); color: var(--mute); font-size: var(--t-xs); flex: none; }
.cp-foot kbd { margin-right: 3px; }

/* ---------- shortcuts dialog ---------- */
.kbdhint { margin: 0 0 var(--s-3); }
.kbdlist { display: grid; gap: 0; }
.kbdrow { display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); padding: var(--s-2) 0; border-bottom: 1px solid var(--line); font-size: var(--t-sm); }
.kbdrow:last-child { border-bottom: 0; }
.kbds { display: inline-flex; gap: var(--s-1); align-items: center; flex: none; }
.kbds em { font-style: normal; color: var(--mute); font-size: var(--t-xs); }

/* ---------- footer ---------- */
footer.sfooter { margin: var(--section-gap) 0 0; padding: 0 0 var(--s-7); text-align: left; color: var(--mute); font-size: var(--t-sm); }
.sfooter .fin { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }
.wrap .sfooter .fin, .wrap > footer.sfooter .fin { padding-inline: 0; }
.fgrid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: var(--s-6) var(--s-5); padding-top: var(--s-6); border-top: 1px solid var(--line); }
.fbrand .logo { display: flex; align-items: center; gap: var(--s-2); margin: 0; color: var(--text-strong); font: 700 var(--t-md)/1 var(--font-display); font-stretch: 85%; }
.fbrand p { color: var(--mute); margin: var(--s-3) 0 0; max-width: 30ch; font-size: var(--t-sm); }
.fcol { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.fcol h4 { margin: 0 0 var(--s-2); font: 600 var(--t-sm) var(--font-body); letter-spacing: 0; text-transform: none; color: var(--text-strong); }
footer .flink { color: var(--mute); text-decoration: none; background: none; border: 0; padding: var(--s-1) 0; font: 400 var(--t-sm) var(--font-body); text-align: left; border-radius: var(--r-xs); min-height: 28px; cursor: pointer; }
footer .flink:hover { color: var(--text-strong); }
.fbase { margin-top: var(--s-6); color: var(--faint); font-size: var(--t-sm); text-align: left; }
.fbase a { color: var(--mute); text-decoration: underline; text-underline-offset: 3px; }
.fbase a:hover { color: var(--text-strong); }

/* ---------- tab bar (phones only) ---------- */
#mtabs.mtabs { display: none; }

/* ---------- narrower desktop ---------- */
@media (max-width: 1000px) {
  .acname, .acbtn > .ic:last-child { display: none; }
  .acbtn { padding: 0 var(--s-1); }
  header.nav .navsearch { flex-basis: 220px; }
}
@media (max-width: 900px) {
  header.nav .logo .lw { display: none; }
  header.nav .navlinks { margin-left: 0; }
  header.nav .navsearch { flex: none; width: var(--ctl); height: var(--ctl); padding: 0; justify-content: center; border-color: transparent; background: none; }
  header.nav .navsearch:hover { background: var(--hover); border-color: transparent; }
  .nstext, .nskbd { display: none; }
  .fgrid { grid-template-columns: 1fr 1fr 1fr; } .fbrand { grid-column: 1 / -1; }
}

/* ---------- phone ---------- */
@media (max-width: 700px) {
  header.nav .navin { gap: var(--s-2); }
  header.nav .navlinks, header.nav .lgn { display: none; }
  header.nav .logo .lw { display: none; }
  header.nav .navsearch { flex: 1; width: auto; max-width: none; height: var(--ctl); padding: 0 var(--s-3); justify-content: flex-start; margin: 0; background: var(--field); border-color: var(--line); }
  header.nav .navsearch:hover { background: var(--field); border-color: var(--line-strong); }
  .nstext { display: block; }
  .popanchor, .acct { position: static; }
  .acpop, .alpop { top: calc(100% + var(--s-1)); right: var(--gutter); max-height: calc(100dvh - var(--nav-h) - var(--tab-h) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--s-4)); }
  .acpop { width: min(320px, calc(100vw - 2 * var(--gutter))); }
  .alpop { left: var(--gutter); width: auto; }
  .themepop { width: min(280px, calc(100vw - 2 * var(--gutter))); }

  #mtabs.mtabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav); height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background: var(--nav-bg); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); border-top: 1px solid var(--line); }
  .mt { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0 var(--s-1); border-radius: 0; color: var(--mute); font: 550 11px/1 var(--font-body); -webkit-tap-highlight-color: transparent; }
  .mt:active { background: var(--hover); }
  .mt span:not([data-reqbadge]) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mt.on { color: var(--accent); }
  .mt .nbadge { position: absolute; top: 6px; left: calc(50% + 6px); }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(var(--tab-h) + var(--s-4) + env(safe-area-inset-bottom, 0px)); }
  .netbar { bottom: calc(var(--tab-h) + var(--s-3) + env(safe-area-inset-bottom, 0px)); }
  .cp-scrim { padding-top: calc(var(--s-3) + env(safe-area-inset-top, 0px)); }
  .cpal { max-height: calc(100dvh - 24px); }
  .cp-foot { display: none; }
  .cp-row { min-height: 54px; }
  .acitem { min-height: var(--ctl); }
  .fgrid { grid-template-columns: 1fr 1fr; gap: var(--s-5) var(--s-4); }
  footer.sfooter { padding-bottom: var(--s-6); }
  .rw-ann { justify-content: flex-start; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .rbar.run { animation: none; transform: scaleX(.6); } .rbar.done { transition: none; }
  .cpal, .cp-scrim, .acpop, .alpop { animation: none !important; }
}

/* ---------- ux pass: account menu labels, back link, 404, one nudge at a time ---------- */
.aclab { padding: var(--s-2) var(--s-3) var(--s-1); color: var(--mute); font: 600 var(--t-sm)/var(--lh-snug) var(--font-body); }
.backlink { display: inline-flex; align-items: center; gap: var(--s-1); min-height: 44px; margin: var(--s-4) 0 calc(-1 * var(--s-2)); color: var(--mute); font-size: var(--t-sm); text-decoration: none; }
.backlink .ic { transform: rotate(180deg); }
.backlink:hover, .backlink:focus-visible { color: var(--text-strong); }
.wrap.nf { padding-block: var(--s-7) var(--s-6); }
/* home shows at most one prominent nudge: dates problem > getting started (which already lists recovery code, install, alerts) > lone recovery banner */
.wrap.home:has(.tf-banner) .gs-slot, .wrap.home:has(.tf-banner) .rw-nudge-banner, .wrap.home:has(.gs) .rw-nudge-banner { display: none; }
@media (pointer: coarse) {
  header.nav .logo { min-width: 44px; min-height: 44px; }
  .gs-head .btn, .tf-banner .btn, .rw-nudge .btn { min-height: 44px; }
}
