/* Brotein: the one stylesheet for every page.

   Type: Archivo (display, wide) and Geist (UI). Shapes: pill buttons, 16px
   cards, 10px inputs. One accent at a time (lime, orange, cobalt, pink or a
   Premium custom colour, chosen in Settings) over a warm light or cool dark
   surface. Shadows are tinted to
   the background, never plain black. No gradients on text, no glass.

   appearance.js sets data-theme and data-accent on <html> before paint. */

:root {
    --font-display: "Archivo", "Geist", system-ui, sans-serif;
    --font-ui: "Geist", system-ui, -apple-system, sans-serif;
    --r-card: 16px;
    --r-input: 10px;
    --r-pill: 999px;
    --nav-h: 68px;
    --wrap: 1280px;
    --rail-w: 232px;

    /* light */
    --bg: #f3f3ef;
    --bg-2: #e8e8e2;
    --surface: #fbfbf9;
    --surface-2: #ffffff;
    --ink: #15161a;
    --ink-2: #4b4d54;
    --ink-3: #777a83;
    --line: #dcdcd6;
    --line-2: #cfcfc8;
    --shadow: 0 18px 44px rgba(21, 22, 26, 0.10), 0 2px 6px rgba(21, 22, 26, 0.05);
    --shadow-lg: 0 40px 90px rgba(21, 22, 26, 0.16);
    --logo-filter: invert(1);
    --ok: #2f8a4b;
    --ok-soft: #dcefe1;
    --bad: #c93b3b;
    --bad-soft: #f7dcdc;
    --warn: #b7791f;

    /* accent: orange (the default; appearance.js leaves data-accent off for it) */
    --accent: #ea7a3a;
    --accent-strong: #d96a2b;
    --accent-ink: #2d1407;
    --accent-text: #b04d12;
    --accent-soft: #f8dcc8;
}

[data-accent="orange"] {
    --accent: #ea7a3a; --accent-strong: #d96a2b; --accent-ink: #2d1407; --accent-text: #b04d12; --accent-soft: #f8dcc8;
}
[data-accent="lime"] {
    --accent: #b7d83a; --accent-strong: #a3c52c; --accent-ink: #1d2a05; --accent-text: #4f6e08; --accent-soft: #e6f2bd;
}
[data-accent="cobalt"] {
    --accent: #3b74f0; --accent-strong: #2c63de; --accent-ink: #0b173a; --accent-text: #1f55cc; --accent-soft: #d6e2fc;
}
[data-accent="pink"] {
    --accent: #fd4e7a; --accent-strong: #e43c68; --accent-ink: #3a0717; --accent-text: #be123c; --accent-soft: #fbd0dc;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #000000; --bg-2: #0d0d0d; --surface: #121212; --surface-2: #1a1a1a;
        --ink: #ffffff; --ink-2: #b5b5b5; --ink-3: #8a8a8a; --line: #232323; --line-2: #2e2e2e;
        --shadow: 0 18px 40px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.5);
        --shadow-lg: 0 40px 90px rgba(0, 0, 0, 0.8);
        --logo-filter: none;
        --ok: #7fd39a; --ok-soft: rgba(127, 211, 154, 0.14); --bad: #ff7b7b; --bad-soft: rgba(255, 123, 123, 0.14); --warn: #f0be78;
        /* orange, brighter on black */
        --accent: #ff7a1a; --accent-strong: #ec6a0c; --accent-ink: #160800; --accent-text: #ff9a52; --accent-soft: rgba(255, 122, 26, 0.16);
    }
    :root:not([data-theme="light"])[data-accent="lime"] { --accent: #b7d83a; --accent-strong: #a3c52c; --accent-ink: #1d2a05; --accent-text: #b7d83a; --accent-soft: rgba(183, 216, 58, 0.14); }
    :root:not([data-theme="light"])[data-accent="cobalt"] { --accent-text: #7ea6ff; --accent-soft: rgba(59, 116, 240, 0.18); }
    :root:not([data-theme="light"])[data-accent="pink"] { --accent-text: #ff8ba8; --accent-soft: rgba(253, 78, 122, 0.16); }
    /* Cards are outlined, not floating, and the phone bar is black. */
    :root:not([data-theme="light"]) .panel, :root:not([data-theme="light"]) .card, :root:not([data-theme="light"]) .card-lg, :root:not([data-theme="light"]) .tier { border: 1px solid var(--line); box-shadow: none; }
    :root:not([data-theme="light"]) .tabbar { background: rgba(0, 0, 0, 0.92); border-color: var(--line); }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #000000; --bg-2: #0d0d0d; --surface: #121212; --surface-2: #1a1a1a;
    --ink: #ffffff; --ink-2: #b5b5b5; --ink-3: #8a8a8a; --line: #232323; --line-2: #2e2e2e;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 40px 90px rgba(0, 0, 0, 0.8);
    --logo-filter: none;
    --ok: #7fd39a; --ok-soft: rgba(127, 211, 154, 0.14); --bad: #ff7b7b; --bad-soft: rgba(255, 123, 123, 0.14); --warn: #f0be78;
    /* orange, brighter on black */
    --accent: #ff7a1a; --accent-strong: #ec6a0c; --accent-ink: #160800; --accent-text: #ff9a52; --accent-soft: rgba(255, 122, 26, 0.16);
}
:root[data-theme="dark"][data-accent="lime"] { --accent: #b7d83a; --accent-strong: #a3c52c; --accent-ink: #1d2a05; --accent-text: #b7d83a; --accent-soft: rgba(183, 216, 58, 0.14); }
:root[data-theme="dark"][data-accent="cobalt"] { --accent-text: #7ea6ff; --accent-soft: rgba(59, 116, 240, 0.18); }
:root[data-theme="dark"][data-accent="pink"] { --accent-text: #ff8ba8; --accent-soft: rgba(253, 78, 122, 0.16); }
:root[data-theme="dark"] .panel, :root[data-theme="dark"] .card, :root[data-theme="dark"] .card-lg, :root[data-theme="dark"] .tier { border: 1px solid var(--line); box-shadow: none; }
:root[data-theme="dark"] .tabbar { background: rgba(0, 0, 0, 0.92); border-color: var(--line); }

/* Older scripts still write these names into inline styles. They resolve to
   the new tokens so nothing they draw falls out of the palette. */
:root {
    --text: var(--ink); --muted: var(--ink-2); --dim: var(--ink-3);
    --line-soft: var(--line); --panel: var(--surface); --panel-solid: var(--surface-2); --black: var(--bg);
    --violet: var(--accent-text); --violet-soft: var(--accent-text); --pink: var(--accent-text); --cream: var(--accent);
    --grad: var(--accent); --grad-tile: var(--accent);
}

/* ==========================================================================
   base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); scrollbar-width: thin; scrollbar-color: var(--line-2) var(--bg); }
html::-webkit-scrollbar { width: 10px; }
html::-webkit-scrollbar-track { background: var(--bg); }
html::-webkit-scrollbar-thumb { background: var(--line-2); border: 2px solid var(--bg); border-radius: var(--r-pill); }
html::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: 12px; top: -48px; padding: 10px 14px; background: var(--ink); color: var(--bg); border-radius: var(--r-pill); z-index: 100; }
.skip:focus { top: 12px; }
.hide { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Signed-out visitors see one set of links, members another (gate.js sets the class). */
html.is-guest .member-only, html.is-member .guest-only { display: none !important; }

/* ==========================================================================
   type
   ========================================================================== */

.display, .h1 { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; letter-spacing: -0.035em; line-height: 0.96; text-wrap: balance; margin: 0; }
h1.display, .h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2.display { font-size: clamp(1.9rem, 3.6vw, 2.8rem); margin: 0 0 14px; }
h3, .h2 { font-family: var(--font-display); font-stretch: 105%; font-weight: 700; letter-spacing: -0.02em; font-size: 1.25rem; margin: 0 0 6px; }
.lead { font-size: 1.1rem; line-height: 1.6; color: var(--ink-2); max-width: 52ch; margin: 16px 0 0; text-wrap: pretty; }
.center .lead { margin-left: auto; margin-right: auto; }
.sub { font-size: 0.92rem; color: var(--ink-3); margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.measure { max-width: 62ch; }
.muted { color: var(--ink-2); }
.center { text-align: center; }
/* Gone from the design; still in a few scripts. */
.eyebrow { display: none; }
.grad { background: none; -webkit-background-clip: initial; background-clip: initial; color: inherit; }

/* ==========================================================================
   buttons: pills, solid, pressable. Hover darkens or lifts; it never fades.
   ========================================================================== */

.btn, .pill, .quiz-btn, .generate-button, .mini-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 46px; padding: 0 22px; border-radius: var(--r-pill); border: 1.5px solid transparent;
    background: var(--ink); color: var(--bg); font-weight: 600; font-size: 0.95rem; white-space: nowrap; cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:hover, .pill:hover, .quiz-btn:hover, .generate-button:hover, .mini-btn:hover { transform: translateY(-1px); }
.btn:active, .pill:active, .quiz-btn:active { transform: translateY(0) scale(0.98); }
.btn.accent, .pill.solid, .quiz-btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.accent:hover, .pill.solid:hover, .quiz-btn.primary:hover { background: var(--accent-strong); }
.btn.quiet, .btn.edge, .pill.edge, .quiz-btn.ghost, .mini-btn { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn.quiet:hover, .btn.edge:hover, .pill.edge:hover, .quiz-btn.ghost:hover, .mini-btn:hover { border-color: var(--ink); }
.btn.white, .generate-button { background: var(--ink); color: var(--bg); }
.btn.danger, .quiz-btn.danger, .mini-btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.danger:hover, .quiz-btn.danger:hover, .mini-btn.danger:hover { background: var(--bad); color: #fff; }
.btn.sm, .pill.sm, .mini-btn { height: 38px; padding: 0 16px; font-size: 0.86rem; }
.btn.xs { height: 32px; padding: 0 12px; font-size: 0.8rem; gap: 6px; }
.btn.wide { width: 100%; }
.btn i, .pill i { font-size: 1.15em; }
.btn svg, .pill svg, .quiz-btn svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.btn svg.arr, .pill svg.arr { fill: none; stroke: currentColor; stroke-width: 2; }
.btn[disabled], .btn.is-disabled, .pill[disabled], .quiz-btn[disabled], .mini-btn[disabled] { opacity: 0.4; pointer-events: none; }

/* a quiet text button */
.link { padding: 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ==========================================================================
   surfaces and layout
   ========================================================================== */

.panel, .card, .card-lg, .tier { background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); }
.card { padding: 22px; }
.card-lg { padding: 30px; }
.card.pad { padding: 22px; }
.card.flat, .panel.flat { box-shadow: none; background: var(--bg-2); }
.panel.raised, .card.raised { box-shadow: var(--shadow-lg); }
.card h3, .card-lg h3, .card .h2, .card-lg .h2 { margin: 0 0 4px; }
.card > .sub, .card-lg > .sub, .card-head .sub { margin-bottom: 16px; }

.wrap, .wrapw, .page-shell { width: min(var(--wrap), calc(100% - 48px)); margin: 0 auto; }
.wrapm { width: min(1060px, calc(100% - 48px)); margin: 0 auto; }
.wraps { width: min(760px, calc(100% - 48px)); margin: 0 auto; }
.pad { padding: 32px 0 110px; }
.section { padding: 96px 0; }
.section + .section { padding-top: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

/* page head on member pages: title left, actions right */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-family: var(--font-display); font-stretch: 108%; font-weight: 800; letter-spacing: -0.03em; font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; line-height: 1; }
.page-head .sub { margin-top: 6px; }
.page-head .acts { display: flex; gap: 10px; flex-wrap: wrap; }

/* ==========================================================================
   public header and footer
   ========================================================================== */

.nav { position: relative; height: var(--nav-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.nav .logo img, .rail .logo img, .foot .logo img { height: 24px; filter: var(--logo-filter); }
.nav .logo img { display: block; width: auto; height: 38px; max-width: 100%; object-fit: contain; }
/* Centred on the bar itself, so the links sit in the middle of the page
   however wide the logo and the buttons either side are. */
.nav .links { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 28px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.nav .links a:hover { color: var(--ink); }
.nav .links a[aria-current="page"] { color: var(--ink); }
.nav .acts { display: flex; align-items: center; gap: 10px; }
@media (max-width: 1040px) { .nav .links { display: none; } }
/* On a phone the logo and both buttons have to share one row. */
@media (max-width: 480px) {
    .nav { gap: 12px; }
    .nav .logo img { height: 36px; max-width: min(34vw, 112px); }
    .nav .acts { gap: 8px; }
    .nav .acts .btn.sm { padding: 0 12px; }
}

.foot { border-top: 1px solid var(--line); margin-top: 96px; padding: 36px 0 44px; display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; color: var(--ink-3); font-size: 0.9rem; }
.foot .logo img { height: 20px; }
.foot nav { display: flex; gap: 22px; flex-wrap: wrap; }
.foot nav a:hover { color: var(--ink); }
.pad .foot { margin-top: 72px; }

/* A segmented choice, not a sun and moon. Also used in Settings. */
.theme-seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--bg-2); }
.theme-seg button { height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: none; color: var(--ink-2); font-size: 0.82rem; font-weight: 500; cursor: pointer; }
.theme-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ==========================================================================
   home page sections
   ========================================================================== */

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 40px; align-items: center; min-height: calc(100dvh - var(--nav-h)); padding: 24px 0 48px; }
.hero .copy { padding-right: 24px; }
.hero .ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero .stage { position: relative; aspect-ratio: 1; max-height: 640px; }
.hero .stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.hero .stage .shadow-pool { position: absolute; left: 50%; bottom: 8%; width: 60%; height: 10%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(21, 22, 26, 0.18), transparent); }
:root[data-theme="dark"] .hero .stage .shadow-pool { background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero .stage .shadow-pool { background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); } }
@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; min-height: 0; gap: 8px; padding: 16px 0 32px; }
    .hero .copy { padding-right: 0; }
    .hero .stage { max-height: 340px; order: -1; }
    h1.display { font-size: clamp(2.4rem, 11vw, 3.2rem); }
}
.rise { animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

.runner { overflow: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 18px 0; margin-bottom: 96px; }
.runner .row { display: flex; gap: 56px; width: max-content; flex-wrap: nowrap; animation: run 28s linear infinite; }
.runner span { font-family: var(--font-display); font-stretch: 118%; font-weight: 800; font-size: clamp(1.6rem, 3.4vw, 2.6rem); letter-spacing: -0.02em; color: var(--ink-3); white-space: nowrap; }
.runner span.on { color: var(--ink); }
@keyframes run { to { transform: translateX(-50%); } }

/* five tools, five cells */
.bento { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-top: 36px; }
.cell { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 300px; padding: 26px; border-radius: var(--r-card); background: var(--surface); box-shadow: var(--shadow); color: inherit; transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.cell:hover { transform: translateY(-3px); }
.cell h3 { font-size: 1.45rem; }
.cell p { margin: 0; color: var(--ink-2); max-width: 40ch; }
.cell .go { position: absolute; top: 22px; right: 22px; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--ink); font-size: 1.1rem; }
.cell .lock { position: absolute; top: 22px; left: 22px; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: var(--r-pill); background: var(--bg-2); color: var(--ink-2); font-size: 0.76rem; font-weight: 600; }
.cell.wide { grid-column: span 4; }
.cell.half { grid-column: span 2; }
.cell.photo { color: #f4f4f0; }
.cell.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cell.photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 13, 16, 0.2) 0%, rgba(12, 13, 16, 0.35) 45%, rgba(12, 13, 16, 0.92) 100%); }
.cell.photo > * { position: relative; z-index: 1; }
.cell.photo p { color: rgba(244, 244, 240, 0.78); }
.cell.photo .go, .cell.photo .lock { background: rgba(255, 255, 255, 0.14); color: #fff; }
.cell.tinted { background: var(--accent); color: var(--accent-ink); }
.cell.tinted p { color: var(--accent-ink); opacity: 0.8; }
.cell.tinted .go, .cell.tinted .lock { background: rgba(0, 0, 0, 0.12); color: var(--accent-ink); }
.cell .big { font-family: var(--font-display); font-stretch: 110%; font-weight: 800; font-size: clamp(2.6rem, 4.5vw, 4rem); letter-spacing: -0.04em; line-height: 1; margin-bottom: auto; }
.cell .big small { display: block; font-family: var(--font-ui); font-stretch: normal; font-weight: 500; font-size: 0.9rem; letter-spacing: 0; margin-top: 6px; opacity: 0.8; }
.cell .plan-preview { margin-bottom: auto; width: 100%; padding-right: 60px; }
.plan-preview .row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.plan-preview .row:last-child { border-bottom: 0; }
.plan-preview .row b { font-weight: 600; }
.plan-preview .row .n { color: var(--ink-3); font-size: 0.8rem; }
.plan-preview .row .sets { color: var(--accent-text); font-weight: 600; }
.week-dots { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; margin-bottom: auto; width: 100%; max-width: 360px; }
.week-dots i { aspect-ratio: 1; min-width: 0; border-radius: 10px; background: var(--bg-2); display: grid; place-items: center; font-style: normal; font-size: 0.8rem; color: var(--ink-3); }
.week-dots i.on { background: var(--ink); color: var(--bg); }
.week-dots i.today { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 900px) { .bento { grid-template-columns: 1fr 1fr; } .cell.wide, .cell.half { grid-column: span 2; } .cell { min-height: 240px; } }

.steps { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
.steps ol { list-style: none; margin: 0; padding: 0; }
.steps li { padding: 26px 0; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0 0 6px; }
.steps li p { margin: 0; color: var(--ink-2); max-width: 44ch; }
.steps figure { margin: 0; border-radius: var(--r-card); overflow: hidden; aspect-ratio: 4 / 5; box-shadow: var(--shadow-lg); }
.steps figure img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } .steps figure { aspect-ratio: 16 / 10; order: -1; } }

.quote { max-width: 30ch; margin: 0; font-family: var(--font-display); font-stretch: 105%; font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.025em; line-height: 1.15; }
.quote-by { display: flex; align-items: center; gap: 12px; margin-top: 22px; color: var(--ink-2); font-size: 0.95rem; }
.quote-by img, .quote-by .av { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; }
.feed-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(300px, 1fr); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 36px 0 8px; scrollbar-width: none; }
.feed-strip::-webkit-scrollbar { display: none; }

.pricing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 36px; }
.tier { padding: 30px; display: flex; flex-direction: column; position: relative; }
.tier.rec { background: var(--accent); color: var(--accent-ink); }
.tier .price { font-family: var(--font-display); font-stretch: 110%; font-weight: 800; font-size: 3rem; letter-spacing: -0.04em; line-height: 1; margin: 18px 0 4px; }
.tier .price small { font-family: var(--font-ui); font-stretch: normal; font-weight: 500; font-size: 0.95rem; letter-spacing: 0; margin-left: 6px; }
.tier ul { list-style: none; margin: 22px 0 28px; padding: 0; display: grid; gap: 10px; }
.tier li { display: flex; gap: 10px; align-items: flex-start; }
.tier li i { margin-top: 3px; color: var(--accent-text); }
.tier.rec li i { color: var(--accent-ink); }
.tier.rec .sub { color: inherit; opacity: 0.75; }
.tier .btn { margin-top: auto; align-self: flex-start; }
.tier.rec .btn { background: var(--accent-ink); color: var(--accent); }
.tier.rec .btn:hover { background: #000; }
.tier .btn.is-current { background: transparent; border-color: currentColor; color: inherit; opacity: 0.7; pointer-events: none; }
@media (max-width: 760px) { .pricing { grid-template-columns: 1fr; } }

/* ==========================================================================
   forms
   ========================================================================== */

.fld, .field { display: grid; gap: 7px; }
.field { margin-bottom: 14px; }
.fld > label, .field > label, .lbl { font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.fields { display: grid; gap: 14px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.inp, .field input, .field select, .field textarea {
    width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-input); border: 1.5px solid var(--line-2);
    background: var(--surface-2); color: var(--ink); font: inherit; font-size: 0.95rem; outline: none;
}
/* iPhone zooms the page into any field under 16px and stays zoomed. */
@media (pointer: coarse) { .inp, .field input, .field select, .field textarea { font-size: 16px; } }
.inp::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.inp:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.inp, .field textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
select.inp, .field select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 40px;
    background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
    background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.inp:-webkit-autofill { -webkit-text-fill-color: var(--ink); -webkit-box-shadow: 0 0 0 40px var(--surface-2) inset; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent-strong); }

/* one control made of several choices */
.seg, .tab-row, .toggle { display: flex; padding: 4px; border-radius: var(--r-input); background: var(--bg-2); }
.seg > *, .tab-row > *, .toggle > * { flex: 1; height: 40px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--ink-2);
           font: inherit; font-size: 0.88rem; font-weight: 500; text-align: center; cursor: pointer; }
.seg > .on, .tab-row > .active, .toggle > .is-active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

.pickrow, .chip-row, .gym-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pick, .filter-chip, .gym-filter-chip { height: 38px; padding: 0 15px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); background: transparent;
        color: var(--ink-2); font: inherit; font-size: 0.86rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; }
.pick:hover, .filter-chip:hover, .gym-filter-chip:hover { border-color: var(--ink); color: var(--ink); }
.pick.on, .filter-chip.is-on, .gym-filter-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }

/* A choice drawn as a small card: a bold line and a note. */
.tile, .quiz-option, .plan-card { display: block; width: 100%; padding: 16px 18px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface-2);
        color: var(--ink); font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease; }
.tile:hover, .quiz-option:hover, .plan-option input:not(:checked) + .plan-card:hover { border-color: var(--ink); }
.tile.on, .quiz-option.is-selected, .plan-option input:checked + .plan-card { border-color: var(--accent-strong); background: var(--accent-soft); }
.tile b { display: block; font-size: 1rem; font-weight: 600; }
.tile > span { display: block; margin-top: 3px; font-size: 0.84rem; color: var(--ink-2); }
.tile:active { transform: scale(0.99); }

.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 0.86rem; line-height: 1.55; color: var(--ink-2); cursor: pointer; }
.consent input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.consent a { color: var(--accent-text); text-decoration: underline; }

/* ==========================================================================
   small pieces
   ========================================================================== */

.kpi b { display: block; font-family: var(--font-display); font-stretch: 108%; font-size: 2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.kpi span { display: block; margin-top: 4px; font-size: 0.8rem; color: var(--ink-3); }
.bignum { font-family: var(--font-display); font-stretch: 110%; font-size: clamp(3.2rem, 8vw, 5.4rem); font-weight: 800; letter-spacing: -0.05em; line-height: 0.95; }
.stat b { display: block; font-family: var(--font-display); font-stretch: 108%; font-size: 1.8rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.stat span { display: block; margin-top: 3px; font-size: 0.78rem; color: var(--ink-3); }

.tag, .chip, .package-tag, .tag-pill, .day-tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: var(--r-pill);
       border: 1.5px solid var(--line-2); font-size: 0.74rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tag.good { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.tag.warn { border-color: transparent; color: var(--warn); }
.tag.bad { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.tag.violet, .chip.level, .tag-pill.admin { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.tag.grad, .chip.premium, .package-tag.premium, .tag-pill.premium, .day-tag { border-color: transparent; background: var(--accent); color: var(--accent-ink); }

.status, .plan-status, .auth-status, .gym-status { margin: 10px 0 0; min-height: 20px; font-size: 0.88rem; color: var(--ink-2); }
.status.ok, .status.success, .plan-status.success, .auth-status.success { color: var(--ok); }
.status.bad, .status.error, .plan-status.error, .auth-status.error, .gym-status.error { color: var(--bad); }

.list > * { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 13px 2px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.list > *:last-child { border-bottom: 0; }
.list .m { color: var(--ink-3); font-size: 0.82rem; }
.list .v { color: var(--accent-text); font-weight: 600; white-space: nowrap; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { padding: 12px 14px; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.tbl td { padding: 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.tbl td:first-child { color: var(--ink); font-weight: 500; }
.tbl tr:last-child td { border-bottom: 0; }

/* faces: initials on a tinted square, or a picture */
.av, .avatar { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; flex: none; overflow: hidden;
      font-size: 0.82rem; font-weight: 700; color: var(--accent-ink); background: var(--accent); }
.av img, .avatar img { width: 100%; height: 100%; object-fit: cover; }
a.av:hover { filter: brightness(0.95); }

.xp-track, .tally-track { height: 8px; border-radius: var(--r-pill); background: var(--bg-2); overflow: hidden; }
.xp-fill { height: 100%; width: 100%; border-radius: var(--r-pill); background: var(--accent); clip-path: inset(0 calc(100% - var(--xp, 0%)) 0 0 round 999px); transition: clip-path 0.5s cubic-bezier(0.2, 0.8, 0.3, 1); }
.tally-fill { height: 100%; width: 0; border-radius: var(--r-pill); background: var(--accent); transition: width 0.6s ease; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.spark i { flex: 1; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--accent); }
.spark i.dim { background: var(--bg-2); }
.ring-num { position: relative; width: 190px; height: 190px; margin: 0 auto; }
.ring-num svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-num .in { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }

.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.week > i { aspect-ratio: 1; min-width: 0; border-radius: 10px; background: var(--bg-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-style: normal; font-size: 0.78rem; font-weight: 500; color: var(--ink-3); }
.week-workout { max-width: 100%; overflow: hidden; color: var(--ink-3); font-size: 0.65rem; font-weight: 400; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.week > i.on { background: var(--ink); color: var(--bg); }
.week > i.missed { outline: 2px solid var(--bad); outline-offset: -2px; }
.week > i.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.week-status { display: grid; place-items: center; line-height: 1; }
.week-status i { font-size: 1rem; }
.week > i.on .week-status { color: var(--ok); }
.week > i.rest .week-status { color: var(--ink-3); }
.week > i.missed .week-status { color: var(--bad); }
.week > i.scheduled .week-status { color: var(--ink-3); }

.bars { display: flex; align-items: flex-end; gap: 9px; height: 110px; }
.bars i { flex: 1; border-radius: 7px 7px 3px 3px; background: var(--accent); }
.bars i.ghost { background: var(--bg-2); }
.bar-cols { display: flex; align-items: flex-end; justify-content: space-between; gap: 9px; height: 120px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-col i { width: 100%; border-radius: 7px 7px 3px 3px; background: var(--accent); min-height: 3px; }
.bar-col i.ghost { background: var(--bg-2); }
.bar-col span { font-size: 0.7rem; color: var(--ink-3); }
.legend { display: flex; gap: 18px; margin-top: 14px; font-size: 0.78rem; color: var(--ink-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; }
.legend i.g { background: var(--bg-2); }

.empty { text-align: center; padding: 8px 0 4px; }
.empty p { margin: 0 0 16px; font-size: 0.92rem; color: var(--ink-2); }
.empty-card { padding: 24px; border-radius: var(--r-card); border: 1.5px dashed var(--line-2); }
.empty-card b { display: block; font-size: 1rem; }
.empty-card p { margin: 5px 0 0; font-size: 0.9rem; line-height: 1.55; color: var(--ink-2); }

/* the three most recent achievements, on the profile and the public profile */
.ach-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ach { padding: 16px 12px 14px; border-radius: 12px; background: var(--bg-2); text-align: center; }
.ach .ic, .ach .ach-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 1.15rem; }
.ach b { display: block; font-size: 0.84rem; font-weight: 600; }
.ach span { display: block; margin-top: 4px; font-size: 0.72rem; color: var(--ink-3); }
.seeall { display: block; margin-top: 14px; text-align: center; font-size: 0.84rem; font-weight: 600; color: var(--accent-text); }
.seeall:hover { text-decoration: underline; }

/* ==========================================================================
   the app shell: rail on the left, the page on the right
   ========================================================================== */

.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; padding: 22px 16px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line); overflow-y: auto; background: var(--bg); scrollbar-width: thin; scrollbar-color: var(--line-2) var(--bg); }
.rail::-webkit-scrollbar { width: 8px; }
.rail::-webkit-scrollbar-track { background: var(--bg); }
.rail::-webkit-scrollbar-thumb { background: var(--line-2); border: 2px solid var(--bg); border-radius: var(--r-pill); }
.rail::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
.rail .logo { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 14px 28px; }
.rail .logo img { height: 32px; }
.rail a, .rail button.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: none; color: var(--ink-2); font-weight: 500; font-size: 0.93rem; text-align: left; cursor: pointer; white-space: nowrap; }
.rail .rail-cap { margin: 14px 12px 4px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.rail .logo + .rail-cap { margin-top: 0; }
/* The XP shop is reached from the profile on a desktop; it is listed only in the phone menu. */
.rail a.phone-only, .rail .rail-copyright { display: none; }
.xp .xp-shop { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); }
.xp .xp-shop:hover { color: var(--ink); }
.rail a:hover, .rail button.item:hover { background: var(--bg-2); color: var(--ink); }
.rail a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.rail a.on .badge { background: var(--accent-ink); color: var(--accent); }
.rail i { font-size: 1.2rem; width: 22px; text-align: center; flex: none; }
.rail .sep { height: 1px; background: var(--line); margin: 10px 8px; }
.rail .grow { flex: 1; }
.rail .badge, .rail .tag { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; }
.main { padding: 26px 32px 120px; min-width: 0; }
.main.narrow { max-width: 900px; }
.main.mid { max-width: 1140px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.topbar h1 { font-family: var(--font-display); font-stretch: 108%; font-weight: 800; letter-spacing: -0.03em; font-size: clamp(1.7rem, 3vw, 2.2rem); margin: 0; line-height: 1; }
.topbar .sub, .topbar .today { margin: 6px 0 0; font-size: 0.9rem; color: var(--ink-3); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.avatar.me { width: 42px; height: 42px; font-size: 0.85rem; }
/* Phones and tablets: the rail goes away and a five-tab bar sits under the thumb, with Today in the middle.
   rail.js builds the bar from the rail links marked data-tab, so the rail stays the one list of pages. */
:root { --tabbar-h: 64px; }
.tabbar, .tools-pop, .sheet-handle, .sheet-top { display: none; }
@font-face { font-family: "Phosphor-Fill"; src: url("https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/fill/Phosphor-Fill.woff2") format("woff2"); font-weight: normal; font-style: normal; font-display: swap; }
@media (max-width: 1080px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .rail { display: none; }
    .main { order: 1; padding: 20px 18px calc(var(--tabbar-h) + 46px + env(safe-area-inset-bottom)); }
    .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: var(--bg); }
    .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: var(--tabbar-h); color: var(--ink-3); font-size: 0.68rem; font-weight: 600; line-height: 1; text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .tabbar a i, .tabbar button i { font-size: 1.35rem; }
    .tabbar button { border: 0; background: none; padding: 0; font-family: inherit; cursor: pointer; }
    .tabbar a.on, .tabbar button.on, .tabbar button.is-open { color: var(--ink); }
    .tabbar a.on i.ph, .tabbar button.on i.ph, .tabbar button.is-open i.ph { font-family: "Phosphor-Fill" !important; }
    .tabbar a.on i, .tabbar button.on i, .tabbar button.is-open i { color: var(--accent-text); }
    /* The Tools menu: a card that sits on top of the page, just above the bar. */
    /* Closed it stays laid out but invisible, so it can slide: the card rises from behind
       the bar while the page behind it dims, and drops back a little quicker on close. */
    .tools-pop { position: fixed; left: 0; right: 0; top: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 39; display: flex; align-items: flex-end; justify-content: center; padding: 12px; visibility: hidden; pointer-events: none; transition: visibility 0s linear 220ms; }
    .tools-pop::before { content: ""; position: absolute; inset: 0; background: rgba(12, 13, 16, 0.55); opacity: 0; transition: opacity 220ms ease; }
    .tools-card { position: relative; z-index: 1; width: 100%; max-width: 520px; max-height: 100%; overflow-y: auto; padding: 16px 10px 10px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); transform: translateY(calc(100% + 24px)); transition: transform 220ms cubic-bezier(0.4, 0, 1, 1); }
    .tools-pop.is-open { visibility: visible; pointer-events: auto; transition: visibility 0s; }
    .tools-pop.is-open::before { opacity: var(--sheet-dim, 1); transition: opacity 320ms ease; }
    .tools-pop.is-dragging::before, .tools-pop.is-dragging .tools-card { transition: none; }
    .tools-pop.is-open .tools-card { transform: none; transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1); }
    .tools-card h2 { margin: 0 12px 8px; font-family: var(--font-ui); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
    .tools-card a { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .tools-card a:hover, .tools-card a:active { background: var(--bg-2); }
    .tools-card a i { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--bg-2); font-size: 1.3rem; }
    .tools-card a.on i { background: var(--accent); color: var(--accent-ink); }
    .tools-card b { display: block; font-size: 0.95rem; font-weight: 600; }
    .tools-card small { display: block; margin-top: 2px; font-size: 0.8rem; line-height: 1.35; color: var(--ink-3); }
    .tabbar a .badge { position: absolute; top: 7px; left: calc(50% + 4px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.66rem; font-weight: 700; display: grid; place-items: center; }
    .tabbar a.is-today i { display: grid; place-items: center; width: 54px; height: 54px; margin-top: -28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 1.5rem; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
    .tabbar a.is-today.on i, .tabbar a.is-today:active i { background: var(--accent-strong); }
    .tabbar a.is-today.on { color: var(--accent-text); }
    /* The profile page carries the rest of the menu under its content. */
    .rail.profile-menu-open { display: flex; flex-direction: column; order: 2; position: static; height: auto; margin: 0 18px; padding: 18px 0 8px; border: 0; border-top: 1px solid var(--line); overflow: visible; }
    .rail.profile-menu-open::before { content: 'More'; margin: 0 12px 6px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
    .rail.profile-menu-open .logo, .rail.profile-menu-open .rail-cap, .rail.profile-menu-open .grow, .rail.profile-menu-open a[data-tab], .rail.profile-menu-open a[data-tool] { display: none; }
    .rail.profile-menu-open a.phone-only { display: flex; }
    /* Every popup is a sheet along the bottom; ui.js slides it up and lets it be dragged down. */
    html .sheet, html .plan-modal, html .bq-backdrop { align-items: flex-end; padding: 12px 0 0; }
    html .sheet-card, html .plan-modal-card { width: 100%; max-width: 640px; max-height: 88dvh; border-radius: 22px 22px 0 0; padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); }
    html dialog.app-notice, html dialog.gif-picker, html dialog.emoji-picker, html dialog.chat-report-dialog { margin: auto auto 0; width: 100%; max-width: 640px; max-height: 88dvh; border: 0; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
    html dialog.app-notice::backdrop, html dialog.gif-picker::backdrop, html dialog.emoji-picker::backdrop, html dialog.chat-report-dialog::backdrop { opacity: var(--sheet-dim, 1); }
    html .gif-picker__inner { max-height: calc(88dvh - 24px); }
    /* The sheet's top bar: stays in view while the sheet scrolls, holds the
       handle and the close button, and is where a drag down starts. */
    .sheet-top { position: sticky; top: -10px; z-index: 3; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; height: 44px; margin: -10px 0 8px; background: inherit; touch-action: none; cursor: grab; }
    .sheet-handle { display: block; grid-column: 2; width: 40px; height: 5px; margin: 0 auto; border-radius: 99px; background: var(--line-2); }
    .sheet-x { grid-column: 3; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink-2); font-size: 1.3rem; cursor: pointer; }
    .sheet-x:active { background: var(--bg-2); color: var(--ink); }
    .tools-card > .sheet-top { margin-bottom: 0; }
    dialog > .sheet-top { margin: 0; }
    /* While a sheet is open the page behind stays put: the backdrop takes no
       swipes, the sheet's own scrolling never spills over, the page is held. */
    html.sheet-open, html.sheet-open body { overflow: hidden; }
    html .sheet, html .bq-backdrop, html .plan-modal { touch-action: none; overscroll-behavior: contain; }
    html .sheet-card, html .plan-modal-card, html .tools-card { overscroll-behavior: contain; }
    @media (prefers-reduced-motion: reduce) {
        .tools-pop, .tools-pop.is-open, .tools-pop::before, .tools-pop.is-open::before, .tools-card, .tools-pop.is-open .tools-card { transition: none; }
    }
    .rail.profile-menu-open { padding-bottom: calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)); }
    .rail.profile-menu-open .rail-copyright { display: block; margin: 22px 12px 0; padding-top: 14px; border-top: 1px solid var(--line); }
    .shell:has(.rail.profile-menu-open) .main { padding-bottom: 8px; }
    .shell:has(.rail.profile-menu-open) .main > .page-copyright { display: none !important; }
    .rail.profile-menu-open a, .rail.profile-menu-open button.item { width: 100%; }
}

/* two columns of cards (profile, my plans) */
.grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.app-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1180px) { .grid, .app-grid { grid-template-columns: minmax(0, 1fr); } .grid > *, .app-grid > * { min-width: 0; } }

.identity { padding: 24px 26px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center; }
.identity .avatar { width: 92px; height: 92px; border-radius: 22px; font-size: 1.9rem; position: relative; overflow: hidden; }
.identity h2 { display: flex; align-items: center; gap: 0.15em; min-width: 0; margin: 0; font-family: var(--font-display); font-stretch: 108%; font-size: 1.9rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1; }
.identity h2 .identity-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity h2 .flame.is-large { width: 0.78em; height: 0.78em; margin: 0; vertical-align: 0; }
.identity .handle { margin: 6px 0 0; font-size: 0.92rem; color: var(--accent-text); font-weight: 600; }
.identity .chips { display: flex; width: 100%; justify-content: space-between; gap: 7px; margin-top: 12px; flex-wrap: wrap; }
.identity .avatar-wrap { display: grid; justify-items: start; gap: 10px; width: 92px; min-width: 0; }
.identity > :nth-child(2) { min-width: 0; }
.identity .avatar-premium { gap: 4px; border: 0; }
.identity .avatar-premium i { font-size: 0.82rem; }
.identity .xp { width: 100%; min-width: 0; margin-top: 14px; }
.identity .xp p { margin: 7px 0 0; font-size: 0.78rem; color: var(--ink-3); }
.identity .xp-shop { white-space: nowrap; }
.top-actions { display: grid; gap: 8px; }
.avatar-wrap { position: relative; }
.avatar-edit { position: absolute; right: -6px; bottom: -6px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--surface); background: var(--ink); color: var(--bg); display: grid; place-items: center; padding: 0; cursor: pointer; }
.avatar-edit svg { width: 14px; height: 14px; fill: currentColor; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.tiles .panel, .tiles .stat { padding: 17px 15px; }
@media (max-width: 1080px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .identity { grid-template-columns: auto minmax(0, 1fr); align-items: start; } .top-actions { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; width: 100%; } .top-actions .btn { min-width: 0; padding: 0 10px; text-align: center; } }
@media (max-width: 760px) {
    .grid .identity { grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto auto auto auto; column-gap: 14px; row-gap: 12px; }
    .grid .identity > .avatar-wrap { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
    .grid .identity > :nth-child(2) { display: contents; }
    .grid .identity h2 { grid-column: 2; grid-row: 1; }
    .grid .identity .handle { grid-column: 2; grid-row: 2; }
    .grid .identity .chips { display: contents; }
    .grid .identity .avatar-premium { grid-column: 1; grid-row: 3; justify-self: start; align-self: center; }
    .grid .identity .chip.level { grid-column: 2; grid-row: 3; justify-self: start; align-self: center; }
    .grid .identity .xp { grid-column: 1 / -1; grid-row: 4; margin-top: 0; }
    .grid .identity > .top-actions { grid-column: 1 / -1; grid-row: 5; }
}

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-head h3, .card-head .h2 { margin: 0 0 4px; }
.card-head .sub { margin: 0; }
.session-tag { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 13px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.session-tag.rest { background: var(--bg-2); color: var(--ink-2); }
.lifts { border-top: 1px solid var(--line); }
.lift { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.lift .n { font-size: 0.8rem; color: var(--ink-3); }
.lift b { font-size: 0.95rem; font-weight: 500; }
.lift .sets { font-size: 0.88rem; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.card-foot .meta { font-size: 0.82rem; color: var(--ink-3); }
.card-foot .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.macros { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.macro { padding: 13px 14px; border-radius: 12px; background: var(--bg-2); }
.macro b { display: block; font-family: var(--font-display); font-stretch: 108%; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.macro span { display: block; margin-top: 2px; font-size: 0.74rem; color: var(--ink-3); }

/* dialogs */
/* How far open a popup is, 0 to 1: dragging a sheet down on a phone dims its backdrop in step (ui.js). */
@property --sheet-dim { syntax: '<number>'; inherits: true; initial-value: 1; }
.sheet, .plan-modal, .bq-backdrop { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(12, 13, 16, calc(0.55 * var(--sheet-dim, 1))); }
.sheet.is-open, .plan-modal:not([hidden]) { display: flex; }
.sheet-card, .plan-modal-card { width: min(480px, 100%); max-height: 86vh; overflow-y: auto; padding: 26px 24px 22px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); }
.sheet-card h3, .plan-modal-card h2 { margin: 0 0 16px; font-size: 1.35rem; }
.plan-modal-card p { margin: 0 0 18px; color: var(--ink-2); line-height: 1.6; font-size: 0.94rem; }
.sheet-actions, .plan-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
/* quick setup (questionnaire.js): it only exists while it is open */
.bq-backdrop { display: flex; }
.bq-card { width: min(440px, 100%); }
.bq-card h3 { margin-bottom: 6px; }
.bq-lead { margin: 0 0 18px; font-size: 0.94rem; line-height: 1.55; color: var(--ink-2); }
.bq-card .fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bq-card .bq-wide { grid-column: 1 / -1; }
.bq-card .seg > * { height: 38px; }
.bq-card input[type="number"] { -moz-appearance: textfield; }
.bq-card input[type="number"]::-webkit-outer-spin-button, .bq-card input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bq-card .bq-status { margin: 12px 0 0; }
.bq-card .bq-status:empty { display: none; }
.bq-card .sheet-actions { margin-top: 18px; }
.bq-card .sheet-actions .btn { flex: 1; }
.pick-list { display: grid; gap: 8px; margin-bottom: 16px; }
.pick-list .pick { display: block; height: auto; width: 100%; padding: 12px 14px; border-radius: 12px; text-align: left; }
.pick-list .pick.is-on { border-color: var(--accent-strong); background: var(--accent-soft); color: var(--ink); }
.pick-list .pick strong { display: block; font-size: 0.92rem; }
.pick-list .pick span { font-size: 0.8rem; color: var(--ink-3); }

/* ==========================================================================
   social: faces, the feed, requests and messages (social-feed.js)
   ========================================================================== */

.social { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.col-feed { width: min(100%, 720px); margin: 0 auto; }
.col-feed > * + * { margin-top: 14px; }
.col-side { position: sticky; top: 20px; display: grid; gap: 16px; }
@media (max-width: 1180px) { .social { grid-template-columns: minmax(0, 1fr); } .col-side { position: static; } .col-feed { width: 100%; } }
.find-people-heading, .notifications-heading { display: flex; align-items: center; gap: 8px; }
.find-people-heading i, .notifications-heading i { color: var(--accent-text); font-size: 1.05em; }
.notification-list { display: grid; }
.notification-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.notification-item:last-child { border-bottom: 0; padding-bottom: 0; }
.notification-item:first-child { padding-top: 0; }
.notification-item:hover .notification-copy > span { color: var(--accent-text); }
.notification-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); }
.notification-icon i { font-size: 1rem; }
.notification-copy { display: grid; gap: 2px; min-width: 0; }
.notification-copy > span { font-size: 0.86rem; line-height: 1.35; transition: color 150ms ease; }
.notification-copy b { font-weight: 600; }
.notification-copy time { font-size: 0.76rem; }
.notification-empty { margin: 0; }

.storyrow { padding: 14px 18px; }
.friends-row, .faces { display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 4px; scrollbar-width: none; }
.friends-row::-webkit-scrollbar, .faces::-webkit-scrollbar { display: none; }
.fr, .face { display: grid; justify-items: center; gap: 7px; width: 68px; flex: none; padding: 0; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 0.76rem; cursor: pointer; }
.fr .av, .face img { width: 56px; height: 56px; border-radius: 16px; font-size: 0.95rem; }
.fr.has-new .av, .face.new img { outline: 3px solid var(--accent); outline-offset: 2px; }
.fr b, .face b { font-weight: 500; max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr:hover { color: var(--ink); }
.fr.add .av { background: var(--bg-2); color: var(--ink-2); font-size: 1.4rem; font-weight: 400; }

.prompt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; }
.prompt .av { width: 46px; height: 46px; border-radius: 14px; }
.prompt b { display: block; font-size: 1rem; font-weight: 600; }
.prompt .sub { margin: 3px 0 0; }

.requests { padding: 14px 16px; border-radius: var(--r-card); background: var(--accent-soft); }
.requests h4 { margin: 0 0 4px; font-size: 0.9rem; font-weight: 600; }
.req, .res { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.req:last-child, .res:last-child { border-bottom: 0; }
.req { transition: opacity 220ms ease, transform 220ms ease; }
.req.is-closing { opacity: 0; transform: translateX(12px); pointer-events: none; }
.req-who, .fr-who { flex: 1; min-width: 0; }
.req-who a, .fr-who b { display: block; font-size: 0.92rem; font-weight: 600; color: var(--ink); }
.req-who a.who-link { display: inline; }
.req-who span, .fr-who span { display: block; font-size: 0.78rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feed { display: grid; gap: 10px; }
.post { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow); scroll-snap-align: start; }
.post.achievement-post { box-shadow: var(--shadow), inset 0 0 0 0.5px var(--accent); }
.post .av, .post img.av { width: 44px; height: 44px; border-radius: 12px; }
.presence-avatar { position: relative; display: inline-flex; flex: 0 0 auto; }
/* In a post the avatar sits in a grid column as tall as the post; keep the wrapper (and its online dot) to the face. */
.post > .presence-avatar { align-self: start; }
.presence-avatar.online::after { content: ""; position: absolute; right: -5px; bottom: -4px; z-index: 2; width: 14px; height: 14px; border: 2px solid var(--surface); border-radius: 50%; background: #2fc56f; box-shadow: 0 0 0 2px rgba(47, 197, 111, 0.28); pointer-events: none; }
.achievement-marker { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 7px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); vertical-align: -0.2em; }
.achievement-marker i { font-size: 0.85rem; }
.post > div { min-width: 0; }
.post p { margin: 2px 0 0; font-size: 0.96rem; line-height: 1.5; color: var(--ink-2); }
.post p b { color: var(--ink); font-weight: 600; }
.post .who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 8px; font-weight: 600; }
/* The flame is a picture: centred on the name, not sat on its baseline. */
.post .who .flame { align-self: center; width: 1.6em; height: 1.6em; margin: 0 -2px; vertical-align: middle; }
.post .who span, .post .who .post-time { font-weight: 400; color: var(--ink-3); font-size: 0.82rem; }
.post .who span { margin-left: 0; }
.post .who .post-time::before { content: "·"; margin-right: 6px; }
.post .meta, .post-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: 0.82rem; color: var(--ink-3); }
.post-foot { justify-content: flex-start; }
.post-actions { display: flex; align-items: center; justify-content: flex-start; flex: 0 1 auto; flex-wrap: nowrap; gap: 6px; }
.post-action { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--r-pill); background: var(--bg-2); color: var(--ink-3); font: inherit; font-size: 0.8rem; font-weight: 500; cursor: pointer; transition: background 150ms ease, border-color 150ms ease, color 150ms ease; }
.post-action:hover:not(:disabled) { border-color: var(--line-2); background: var(--surface); color: var(--ink); }
.post-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-action:disabled { cursor: default; opacity: 0.65; }
.post-action.is-liked { border-color: var(--bad); color: var(--bad); }
.post-action.is-reported { color: var(--ink-3); }
.post-action i { font-size: 1rem; }
.post-action.report-action { width: 34px; flex: none; padding: 0; }
.post-action.like-action, .post-action.reply-action { gap: 5px; padding: 0 12px 0 10px; font-variant-numeric: tabular-nums; }
.post-action.like-action i, .post-action.reply-action i { font-size: 1.1rem; }
.post-delete { position: absolute; top: 10px; right: 10px; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg-2); color: var(--ink-3); cursor: pointer; opacity: 1; transition: background 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease; }
.post-delete:hover { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.post-delete:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
   .post-delete { opacity: 0; pointer-events: none; }
   .post:hover .post-delete, .post:focus-within .post-delete { opacity: 1; pointer-events: auto; }
}
@media (max-width: 600px) {
   .post-foot { align-items: flex-start; gap: 6px; }
   .post-delete { top: 8px; right: 8px; width: 32px; height: 32px; }
}
.post-replies { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.post-replies[hidden] { display: none; }
.post-reply-list { display: grid; gap: 8px; max-height: 260px; overflow-y: auto; }
.post-reply { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); }
.post-reply > .av { width: 32px; height: 32px; border-radius: 9px; font-size: 0.7rem; }
.post-reply > div { min-width: 0; }
.post-reply-head { display: flex; align-items: baseline; gap: 10px; font-size: 0.82rem; }
.post-reply-head > span { color: var(--ink-3); font-size: 0.74rem; }
.post-reply p { margin: 4px 0 0; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-composer { display: flex; gap: 8px; margin-top: 10px; }
.reply-composer .inp { flex: 1; min-width: 0; height: 38px; }
.reply-composer .btn { flex: 0 0 38px; width: 38px; height: 38px; padding: 0; }
.post-replies .status:empty { display: none; }
.who-link { color: var(--ink); font-weight: 600; }
.who-link:hover { text-decoration: underline; }
.when { font-size: 0.8rem; color: var(--ink-3); }
.unread { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-style: normal; font-size: 0.7rem; font-weight: 700; vertical-align: middle; }
h3 .unread { margin-left: 8px; }

.mess { display: grid; grid-template-columns: 170px minmax(0, 1fr); height: 440px; margin: 16px -22px -22px; border-top: 1px solid var(--line); }
.mess > * { min-height: 0; }
.lst { overflow-y: auto; padding: 10px; border-right: 1px solid var(--line); }
.lst .sub { margin: 0; padding: 8px; }
.ci { display: flex; gap: 10px; align-items: center; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ci:hover { background: var(--bg-2); }
.ci.on { background: var(--bg-2); }
.ci .av { width: 32px; height: 32px; border-radius: 9px; font-size: 0.7rem; }
.ci div { flex: 1; min-width: 0; }
.ci b { display: block; font-size: 0.88rem; font-weight: 600; }
.ci div span { display: block; font-size: 0.76rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci i { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-style: normal; font-size: 0.68rem; font-weight: 700; display: grid; place-items: center; }
.thread { display: flex; flex-direction: column; min-width: 0; }
.th-head { display: flex; gap: 10px; align-items: center; min-height: 58px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.th-head .av { width: 34px; height: 34px; border-radius: 10px; font-size: 0.74rem; }
.report-chat-btn { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; margin-left: auto; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--bg-2); color: var(--ink-3); font: inherit; cursor: pointer; transition: background 150ms ease, border-color 150ms ease, color 150ms ease; }
.report-chat-btn i { font-size: 1.05rem; }
.report-chat-btn:hover, .report-chat-btn:focus-visible { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.report-chat-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.msgs { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; overflow-y: auto; }
.msgs .sub { margin: auto; }
.b { max-width: 78%; padding: 9px 13px; border-radius: 16px; font-size: 0.9rem; line-height: 1.4; overflow-wrap: anywhere; }
.b.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 5px; }
.b.them { align-self: flex-start; background: var(--bg-2); border-bottom-left-radius: 5px; }
/* yours, shown the moment you send it; full colour once the server has it */
.b.me.is-pending { opacity: 0.6; }
.b .t { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 2px 7px; margin-top: 3px; font-size: 0.66rem; opacity: 0.6; }
.b .t time, .b .receipt { white-space: nowrap; }
.b .receipt { display: inline-flex; flex: 0 0 auto; align-items: center; margin: 0; line-height: 1; }
.b .receipt i { font-size: 0.82rem; }
.b .receipt.is-seen { color: var(--accent-text); }
.b.me .receipt.is-seen { color: var(--accent-ink); }
.day-line { align-self: center; margin: 6px 0; font-size: 0.72rem; font-weight: 600; color: var(--ink-3); }
.composer { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.composer .inp { flex: 1; min-width: 0; height: 40px; }
#chatStatus { margin: 0; padding: 0 16px 8px; font-size: 0.8rem; color: var(--bad); }
#chatStatus:empty { display: none; }
.col-side .mess { grid-template-columns: 150px minmax(0, 1fr); height: 420px; }
.col-side .ci div span { display: none; }
@media (max-width: 600px) {
    .mess { grid-template-columns: 1fr; height: auto; }
    .lst { max-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
    .msgs { min-height: 260px; }
}

/* today's session: the one dark card on the page, and it tilts */
.tilt { transform-style: preserve-3d; transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1); will-change: transform; }
.today-card { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 26px 28px; background: var(--ink); color: var(--bg); border-radius: var(--r-card); box-shadow: var(--shadow-lg); }
.today-card.is-complete { box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--ok); }
.today-card > div:first-child { grid-column: 1; grid-row: 1; }
.today-card > .stage3d { grid-column: 2; grid-row: 1; justify-self: center; }
.today-card > .week-progress { grid-column: 3; grid-row: 1; justify-self: end; }
:root[data-theme="dark"] .today-card { background: var(--surface-2); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .today-card { background: var(--surface-2); color: var(--ink); } }
.today-card .kicker { font-weight: 600; opacity: 0.7; font-size: 0.9rem; }
.today-card.is-complete #promptText { display: inline-flex !important; align-items: center; gap: 6px; color: var(--ok); opacity: 1; }
.today-card h2 { display: flex; align-items: center; gap: 14px; font-family: var(--font-display); font-stretch: 110%; font-weight: 800; letter-spacing: -0.035em; font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 6px 0 8px; line-height: 1; }
.today-card h2 span { min-width: 0; }
.week-progress { display: grid; align-self: center; justify-self: center; justify-items: center; gap: 4px; }
.week-progress .kicker { line-height: 1; text-align: center; }
.today-card .day-icon { display: grid; place-items: center; flex: 0 0 52px; width: 52px; height: 52px; border-radius: 15px; background: var(--accent); color: var(--accent-ink); font-size: 1.45rem; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 24%, transparent); }
.today-card .lifts { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 0.92rem; opacity: 0.85; border: 0; }
.today-card .btn { background: var(--accent); color: var(--accent-ink); }
.today-card .btn:hover { background: var(--accent-strong); }
.today-card .btn.quiet { background: transparent; color: inherit; border-color: currentColor; }
.today-card .stage3d { position: relative; align-self: center; width: 100%; height: 190px; }
.today-card .stage3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.stage3d-fallback { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 1; }
.stage3d-fallback svg { display: none; width: 100%; height: 100%; overflow: visible; }
.stage3d:not([data-model="beach-chair"]) .fallback-dumbbell { display: block; }
.stage3d[data-model="beach-chair"] .fallback-chair { display: block; }
.stage3d.is-webgl-ready .stage3d-fallback { display: none; }
.today-card .stage3d .shadow-pool { position: absolute; left: 50%; bottom: 8%; width: 60%; height: 10%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.5), transparent); }
.ring { width: 92px; height: 92px; }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: rgba(128, 128, 128, 0.25); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.ring text { fill: currentColor; font-family: var(--font-display); font-weight: 800; font-size: 22px; }
@media (max-width: 600px) { .today-card { grid-template-columns: 1fr; } .today-card > div:first-child, .today-card > .stage3d, .today-card > .week-progress { grid-column: 1; } .today-card > div:first-child { grid-row: 1; } .today-card > .stage3d { grid-row: 2; width: min(100%, 220px); height: 150px; justify-self: center; } .today-card > .week-progress { grid-row: 3; justify-self: center; } }
@media (max-width: 360px) { .compose-foot { flex-wrap: wrap; } .compose-actions { max-width: 100%; flex-wrap: nowrap; } }

/* ==========================================================================
   someone else's public profile
   ========================================================================== */

.page { width: min(1060px, calc(100% - 48px)); margin: 0 auto; padding: 32px 0 110px; }
.big-card { overflow: hidden; }
.card-top { padding: 30px 32px 26px; border-bottom: 1px solid var(--line); }
.card-top .identity { width: 100%; min-width: 0; padding: 0; grid-template-columns: minmax(180px, 220px) minmax(0, 1fr) auto; }
.profile-avatar-meta { width: 100%; min-width: 0; }
.profile-avatar-meta .avatar { width: 92px; height: 92px; }
.profile-avatar-meta .since { margin: 10px 0 0; font-size: 0.78rem; line-height: 1.35; color: var(--ink-3); }
.profile-avatar-meta .xp { max-width: none; margin-top: 10px; }
.profile-avatar-meta .xp p { font-size: 0.72rem; line-height: 1.35; }
.stat-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stat-row .stat { padding: 22px 18px; text-align: center; border-right: 1px solid var(--line); }
.stat-row .stat:last-child { border-right: 0; }
.card-body { padding: 26px 32px 32px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 26px; }
.showcase h2 { margin: 0 0 12px; font-size: 0.82rem; font-weight: 600; color: var(--ink-3); }
.showcase > * + h2 { margin-top: 22px; }
.box { padding: 18px; border-radius: 12px; background: var(--bg-2); }
.box h3 { margin: 0 0 3px; font-size: 1.05rem; }
.box p { margin: 0; font-size: 0.9rem; line-height: 1.6; color: var(--ink-2); }
.box .bio { white-space: pre-wrap; }
.box .ach { background: var(--surface); }
@media (max-width: 900px) {
    .card-body { grid-template-columns: 1fr; padding: 22px 20px 26px; }
    .stat-row { grid-template-columns: repeat(2, 1fr); }
    .card-top { padding: 24px 20px 22px; }
    .card-top .identity { grid-template-columns: 140px minmax(0, 1fr); gap: 16px; }
    .card-top .identity > :nth-child(2) { min-width: 0; }
    .card-top .identity > .top-actions { grid-column: 1 / -1; }
    .card-top .identity > .top-actions > * { min-width: 0; }
}
@media (max-width: 1080px) {
    .big-card .top-actions .chip { min-width: 0; height: auto; min-height: 26px; padding: 4px 8px; line-height: 1.2; white-space: normal; text-align: center; justify-content: center; }
}

/* ==========================================================================
   the workout (workout.js)
   ========================================================================== */

.wk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.wk-head h1 { font-family: var(--font-display); font-stretch: 112%; font-weight: 800; letter-spacing: -0.035em; font-size: clamp(2.2rem, 4vw, 3.2rem); margin: 4px 0 0; line-height: 1; }
.wk-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 0.92rem; font-weight: 500; }
.wk-back:hover { color: var(--ink); }
.wk-progress { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; }
.progress, .wk-bar { flex: 1; height: 10px; border-radius: var(--r-pill); background: var(--bg-2); overflow: hidden; }
.progress i, .wk-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: var(--r-pill); transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
.wk-count { font-size: 0.88rem; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ex { padding: 22px 24px; }
.ex + .ex, .ex + .wk-card, #wkBody > * + * { margin-top: 12px; }
.ex .ex-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 2px; }
.ex .ex-top h2, .ex .ex-top h3 { margin: 0; font-family: var(--font-display); font-stretch: 105%; font-weight: 700; letter-spacing: -0.02em; font-size: 1.3rem; }
.ex.is-complete .ex-top h2::after { content: " \2713"; color: var(--ok); }
.ex .target { color: var(--ink-3); font-size: 0.88rem; white-space: nowrap; }
.ex-alt { margin: 2px 0 0; font-size: 0.8rem; color: var(--ink-3); }
.ex-last, .ex .last { font-size: 0.88rem; color: var(--ink-2); margin: 8px 0 8px; }
.ex-last b, .ex .last b { font-weight: 600; color: var(--ink); }
.set { display: grid; grid-template-columns: 28px minmax(0, 1fr) minmax(0, 1fr) 52px; gap: 10px; align-items: center; padding: 6px 0; }
.set.timed { grid-template-columns: 28px minmax(0, 1fr) 52px; }
.set .no { font-size: 0.82rem; font-weight: 600; color: var(--ink-3); text-align: center; }
.set label { position: relative; display: block; }
.set input { width: 100%; height: 52px; padding: 0 48px 0 16px; border-radius: var(--r-input); border: 1.5px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; outline: none; }
.set input::-webkit-outer-spin-button, .set input::-webkit-inner-spin-button { -webkit-appearance: none; }
.set input::placeholder { color: var(--ink-3); font-weight: 400; font-size: 0.95rem; }
.set input:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.set label span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 0.78rem; color: var(--ink-3); pointer-events: none; }
.tick { width: 52px; height: 52px; border-radius: 50%; border: 1.5px solid var(--line-2); background: var(--surface-2); color: var(--ink-3); cursor: pointer; display: grid; place-items: center; font-size: 1.2rem; padding: 0; transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.tick svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tick:active { transform: scale(0.92); }
.set.done input { background: var(--accent-soft); border-color: transparent; }
.set.done .tick { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.set.saving .tick { opacity: 0.55; }
.set.failed .tick { border-color: var(--bad); color: var(--bad); }
.set-err { grid-column: 2 / -1; margin: -4px 0 4px; font-size: 0.8rem; color: var(--bad); }
.set-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.add-set, .remove-set { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 0; border: 0; background: none; color: var(--accent-text); font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.remove-set { color: var(--ink-2); }
.add-set i, .remove-set i { font-size: 1rem; }
.add-set:hover:not(:disabled), .remove-set:hover:not(:disabled) { text-decoration: underline; }
.add-set:disabled, .remove-set:disabled { opacity: 0.45; cursor: not-allowed; }
.set-limit-notice { margin: 8px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 0.84rem; }
.set-limit-notice[hidden] { display: none; }
.wk-foot { position: sticky; bottom: 0; z-index: 5; margin: 20px -32px -120px; padding: 16px 32px 28px; background: linear-gradient(to bottom, transparent, var(--bg) 35%); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.wk-foot .in { display: contents; }
.wk-foot .btn { min-width: 220px; height: 52px; }
.wk-foot .note { font-size: 0.8rem; color: var(--ink-3); max-width: 220px; }
@media (max-width: 1080px) { .wk-foot { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); margin: 20px -18px -110px; padding: 14px 18px 24px; } .wk-foot .note { display: none; } .wk-foot .btn { flex: 1; } }
.wk-card { padding: 30px 26px; text-align: center; }
.wk-card p { max-width: 420px; margin: 10px auto 0; color: var(--ink-2); line-height: 1.6; }
.wk-card .btn { margin-top: 20px; }
.wk-notice { margin: 0 0 14px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 0.88rem; line-height: 1.55; }
.wk-notice:empty { display: none; }
.done-card { padding: 34px 26px; text-align: center; }
.done-card .glow-bg { display: none; }
.done-card .h1 { font-size: clamp(2rem, 6vw, 2.8rem) !important; margin: 0; }
.done-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.done-stats div { padding: 14px 8px; border-radius: 12px; background: var(--bg-2); }
.done-stats b { display: block; font-family: var(--font-display); font-stretch: 108%; font-size: 1.6rem; font-weight: 800; letter-spacing: -0.03em; }
.done-stats span { font-size: 0.76rem; color: var(--ink-3); }
.done-stats .calorie-stat b { font-size: clamp(1.1rem, 3.6vw, 1.6rem); }
.done-stats .calorie-stat span { display: block; }
.calorie-estimate-note { margin: 10px 0 0; font-size: 0.76rem; }
.wins { margin: 10px auto 0; padding: 0; list-style: none; max-width: 420px; text-align: left; }
.wins li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.wins li:last-child { border-bottom: 0; }
.wins li b { color: var(--ok); font-weight: 600; white-space: nowrap; }
.done-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }

/* the plate stack: CSS only */
.plates { position: relative; width: 120px; height: 120px; perspective: 700px; flex: none; }
.plates .p { position: absolute; left: 50%; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: var(--surface-2); box-shadow: inset 0 0 0 10px var(--bg-2), var(--shadow); transform: rotateX(62deg) translateZ(calc(var(--z) * 1px)); transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.plates .p.acc { background: var(--accent); box-shadow: inset 0 0 0 10px var(--accent-strong), var(--shadow); }
.plates:hover .p { transform: rotateX(62deg) translateZ(calc(var(--z) * 1.9px)); }

/* ==========================================================================
   settings
   ========================================================================== */

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 10px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); background: var(--surface-2); color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.swatch i { width: 24px; height: 24px; border-radius: 50%; background: var(--sw); }
.swatch[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }
.custom-accent-option { position: relative; display: flex; align-items: center; }
.custom-swatch { --sw: #b7d83a; cursor: pointer; }
.custom-swatch[aria-disabled="true"] { opacity: 0.72; cursor: not-allowed; }
.custom-swatch[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }
.custom-accent-picker { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.custom-accent-picker[hidden] { display: none !important; }
.custom-accent-picker input[type="color"] { width: 38px; height: 38px; padding: 3px; border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface); cursor: pointer; }
.custom-accent-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.custom-accent-picker input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.custom-accent-picker input[type="color"]:disabled { cursor: not-allowed; }
.custom-accent-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); font: 1.4rem/1 var(--font-ui); cursor: pointer; }
.custom-accent-close:hover { background: var(--surface-2); color: var(--ink); }
.custom-accent-lock { display: inline-flex !important; align-items: center; gap: 4px; margin: 0 !important; color: var(--ink-3) !important; font-size: 0.72rem !important; }
.custom-accent-lock[hidden] { display: none !important; }
.custom-accent-note { margin: 8px 0 0; }
.custom-accent-note a { color: var(--accent-text); font-weight: 600; }
.settings-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row b { display: block; font-size: 0.95rem; font-weight: 600; }
.settings-row span { display: block; margin-top: 2px; font-size: 0.84rem; color: var(--ink-3); }
.settings-row .inp { max-width: 320px; }
.danger-card { border: 1.5px solid var(--bad-soft); }
@media (max-width: 640px) { .settings-row { flex-direction: column; align-items: stretch; } .settings-row .inp { max-width: none; } }

/* ==========================================================================
   motion and small screens
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .runner .row { animation: none; }
    .rise { animation: none; }
   .tilt, .cell, .btn, .plates .p, .tile, .req { transition: none; }
    .plates:hover .p { transform: rotateX(62deg) translateZ(calc(var(--z) * 1px)); }
    html { scroll-behavior: auto; }
}

@media (max-width: 900px) {
    .g2, .g3, .g4 { grid-template-columns: 1fr; }
    .fields.two, .fields.three { grid-template-columns: 1fr; }
    .card-lg { padding: 22px; }
    .wrap, .wrapw, .wrapm, .wraps, .page-shell, .page { width: calc(100% - 32px); }
    .pad { padding: 20px 0 90px; }
    .section { padding: 64px 0; }
}

/* ==========================================================================
   posts: writing one, and how one reads in the feed
   ========================================================================== */

.compose { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; }
.compose .av { width: 44px; height: 44px; border-radius: 12px; }
.compose textarea.inp { min-height: 48px; height: 48px; padding: 11px 14px; resize: none; line-height: 1.45; overflow: hidden; }
.compose-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }
.compose-foot .sub { font-variant-numeric: tabular-nums; }
.compose-actions { display: grid; grid-template-columns: 38px 96px 38px; align-items: center; gap: 8px; width: min(100%, 188px); max-width: 100%; margin-left: auto; }
.compose-actions > button { min-width: 0; width: 100%; }
.compose-actions #emojiBtn, .compose-actions #postBtn { width: 38px; padding: 0; }
.compose-actions #gifBtn { min-width: 0; padding: 0 8px; white-space: nowrap; }
.compose-actions #postBtn i { font-size: 1rem; }
.compose-gif-preview { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; }
.compose-gif-preview[hidden] { display: none; }
.compose-gif-preview img { display: block; width: min(220px, 100%); max-height: 150px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; }
.gif-picker { width: min(680px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.gif-picker::backdrop { background: rgb(0 0 0 / 58%); }
.gif-picker__inner { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto; max-height: min(760px, calc(100vh - 32px)); padding: 18px; }
.gif-picker__head, .gif-picker__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gif-picker__head h2 { margin: 0; font-size: 1.1rem; }
.gif-picker__search { display: flex; gap: 8px; margin: 14px 0 8px; }
.gif-picker__search input { min-width: 0; flex: 1; }
.gif-picker__status { min-height: 1.4em; margin: 4px 0 10px; color: var(--ink-2); font-size: 0.88rem; }
.gif-picker__results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; gap: 8px; min-height: 110px; overflow-y: auto; }
.gif-picker__result { min-width: 0; aspect-ratio: 1.35; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); cursor: pointer; }
.gif-picker__result img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gif-picker__foot { padding-top: 12px; color: var(--ink-3); font-size: 0.78rem; }
.emoji-picker { width: min(390px, calc(100vw - 32px)); max-height: min(520px, calc(100vh - 32px)); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.emoji-picker::backdrop { background: rgb(0 0 0 / 58%); }
.emoji-picker__inner { padding: 18px; }
.emoji-picker__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.emoji-picker__head h2 { margin: 0; font-size: 1.1rem; }
.emoji-picker__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.emoji-picker__choice { display: grid; place-items: center; min-width: 0; aspect-ratio: 1; padding: 0; border: 1px solid transparent; border-radius: 10px; background: var(--bg-2); font: inherit; font-size: 1.35rem; cursor: pointer; }
.emoji-picker__choice:hover, .emoji-picker__choice:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.emoji-picker__status:empty { display: none; }
.emoji-picker__status { margin: 12px 0 0; color: var(--bad); font-size: 0.82rem; }
.chat-report-dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.chat-report-dialog::backdrop { background: rgb(0 0 0 / 58%); }
.chat-report__form { display: grid; gap: 10px; padding: 20px; }
.chat-report__head, .chat-report__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-report__head h2 { margin: 0; font-size: 1.1rem; }
.chat-report__form > p { margin: 0; }
.chat-report__form > label { margin-top: 4px; font-size: 0.84rem; font-weight: 600; }
.chat-report__form textarea { min-height: 100px; resize: vertical; }
.chat-report__status { min-height: 1.3em; margin: 0; color: var(--bad); font-size: 0.82rem; }
.chat-report__status:empty { display: none; }
.chat-report__status.is-success { color: var(--ok); }
.chat-report__actions { justify-content: flex-end; margin-top: 4px; }
/* The box is sized before the GIF arrives, so the feed doesn't jump when it does. */
.post-gif { display: block; width: min(420px, 100%); aspect-ratio: 4 / 3; max-height: 320px; margin-top: 10px; border-radius: 8px; object-fit: contain; object-position: left center; background: var(--bg-2); }
.compose .status:empty { display: none; }
.post .body { margin: 6px 0 0; font-size: 1rem; line-height: 1.5; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.post .handle { font-size: 0.84rem; color: var(--ink-3); }
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.scope { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--bg-2); }
.scope button { height: 32px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: none; color: var(--ink-2); font: inherit; font-size: 0.84rem; font-weight: 500; cursor: pointer; }
.scope button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ==========================================================================
   blobatar faces (avatars.js): the drawing fills its tile
   ========================================================================== */

[data-avatar] > svg { display: block; width: 100%; height: 100%; }
.av.is-blob, .avatar.is-blob { background: var(--bg-2); padding: 0; }


/* ==========================================================================
   The streak (streak.js): the number with its flame, the two shield slots,
   the tier line and eight weeks of days. One flame, lit or not.
   ========================================================================== */

.streak { display: grid; gap: 10px; }
.streak-top { display: flex; align-items: center; gap: 12px; }
.streak-flame { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--line); color: var(--ink-3); font-size: 1.45rem; line-height: 1; }
.streak.is-lit .streak-flame { background: var(--accent); color: var(--accent-ink); }
.streak.is-risk .streak-flame { background: var(--bad-soft); color: var(--bad); }
.streak-count b { display: block; font-family: var(--font-display); font-stretch: 108%; font-size: 2.1rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.streak-count span { display: block; margin-top: 3px; font-size: 0.8rem; color: var(--ink-3); white-space: nowrap; }
.streak-savers { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; padding: 5px 10px 5px 8px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent-text); font-size: 0.86rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.streak-savers i { font-size: 1.05rem; }
a.streak-savers:hover { background: var(--accent); color: var(--accent-ink); }
.streak-tier { margin: 0; font-size: 0.84rem; font-weight: 500; color: var(--ink-2); }
.streak-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(7, auto); grid-auto-flow: column; gap: 4px; max-width: 264px; }
.streak-grid i { aspect-ratio: 1; min-width: 0; border-radius: 4px; background: var(--line); }
.streak-grid i.none { opacity: 0.6; }
.streak-grid i.rest { background: color-mix(in srgb, var(--accent) 32%, var(--surface)); }
.streak-grid i.done { background: var(--accent); }
.streak-grid i.shield { background: var(--accent-soft); outline: 1.5px solid var(--accent-strong); outline-offset: -1.5px; }
.streak-grid i.missed, .streak-key i.missed, .chain i.missed { position: relative; background: var(--bad); }
.streak-grid i.missed::after, .streak-key i.missed::after, .chain i.missed::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; margin-top: -1px; border-radius: 2px; background: var(--bg); transform: rotate(-45deg); }
.streak-grid i.holiday, .streak-key i.holiday { background: color-mix(in srgb, var(--ink-3) 40%, transparent); }
.streak-grid i.pending { background: transparent; outline: 2px solid var(--accent); outline-offset: -2px; }
.streak-grid i.future { background: transparent; }
.streak-key { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; font-size: 0.72rem; color: var(--ink-3); }
.streak-key li { display: inline-flex; align-items: center; gap: 5px; }
.streak-key i { width: 10px; height: 10px; border-radius: 3px; background: var(--accent); }
.streak-key i.rest { background: color-mix(in srgb, var(--accent) 32%, var(--surface)); }
.streak-key i.shield { background: var(--accent-soft); outline: 1.5px solid var(--accent-strong); outline-offset: -1.5px; }
.streak-risk { margin: 0; font-size: 0.84rem; color: var(--ink-2); }
.streak.is-risk .streak-risk { font-weight: 600; color: var(--bad); }
.streak.is-compact { gap: 6px; }
.streak.is-compact .streak-flame { width: 40px; height: 40px; border-radius: 12px; font-size: 1.25rem; }
.streak.is-compact .streak-count b { font-size: 1.7rem; }

/* The chain (the hub): fourteen days as links. A session is a filled link, a
   rest day a hollow one, a missed day leaves a gap, today's link is open. */
.chain { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); align-items: center; gap: 6px; padding: 2px 0; }
.chain i { aspect-ratio: 1; min-width: 0; border-radius: 50%; border: 3px solid var(--line-2); background: transparent; }
.chain i.none { border-color: var(--line); }
.chain i.done { border-color: var(--accent); background: var(--accent); }
.chain i.rest { border-color: color-mix(in srgb, var(--accent) 55%, var(--bg-2)); }
.chain i.shield { border-color: var(--accent-strong); background: var(--accent-soft); }
.chain i.missed { border-color: var(--bad); }
.chain i.missed::after { height: 2.5px; margin-top: -1.25px; }
.chain i.holiday { border-color: var(--ink-3); border-style: dotted; background: transparent; }
.chain i.pending { border-color: var(--ink); border-style: dashed; }
.chain-flame { position: absolute; inset: 0; display: grid; place-items: center; color: #4c4c4c; font-size: 0.95rem; line-height: 1; opacity: 0.9; pointer-events: none; }
.streak-chain { gap: 14px; }
.streak-chain .streak-count b .streak-flame { display: inline-grid; width: 1em; height: 1em; margin: 0 0.1em 0 0; border-radius: 0; vertical-align: -0.15em; }
.streak-chain .streak-count b .streak-flame img { width: 100%; height: 100%; transform: none; }

/* The flame beside a name. Five stages, each with its own mark and a louder
   look than the one before: grey, accent, tinted chip, solid chip, inverted. */
.flame { display: inline-grid; place-items: center; flex: none; width: 1.35em; height: 1.35em; margin-left: 0.3em; border-radius: 50%; font-size: 0.95em; font-style: normal; line-height: 1; vertical-align: -0.2em; color: var(--ink-3); }
.flame[hidden] { display: none; }
.flame.t1 { color: var(--ink-3); }
.flame.t2 { color: var(--accent-text); }
.flame.t3 { background: var(--accent-soft); color: var(--accent-text); }
.flame.t4 { background: var(--accent); color: var(--accent-ink); }
.flame.t5 { background: var(--ink); color: var(--bg); }
.flame.is-large { width: 1.15em; height: 1.15em; font-size: 0.72em; vertical-align: 0.08em; }
/* The marks are pictures now (streak-*.png): no box behind them, the picture
   fills the slot. The admin crown is the black one. */
.streak-flame { background: none !important; color: inherit; }
.streak-flame img, .flame img, .streak-zero img { display: block; width: 100%; height: 100%; object-fit: contain; }
.streak-flame img { width: 46px; height: 46px; transform: scale(1.4); }
.streak.is-compact .streak-flame img { width: 40px; height: 40px; }
.streak.is-risk .streak-flame img { filter: saturate(0.6) brightness(0.8); }
.flame { background: none !important; width: 1.5em; height: 1.5em; margin-left: 0.2em; border-radius: 0; vertical-align: -0.35em; }
.flame.t5, .flame.tadmin { width: 1.7em; height: 1.7em; vertical-align: -0.4em; }
.flame.is-large { width: 1.25em; height: 1.25em; font-size: 1em; vertical-align: -0.2em; }
.flame.is-large.t5, .flame.is-large.tadmin { width: 1.45em; height: 1.45em; }
.streak-zero img { width: 1.5em; height: 1.5em; opacity: 0.55; }

.flame.is-large.t1, .flame.is-large.t2 { background: var(--bg-2); }

/* The hub: today's session, the chain and who has written sit in the side
   column. On one column they come straight after the row of faces. */
.today-card.is-side { grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 22px; }
.today-card.is-side > div:first-child { grid-column: 1; grid-row: 1; }
.today-card.is-side > .week-progress { grid-column: 2; grid-row: 1; align-self: start; justify-self: end; }
.today-card.is-side > .stage3d { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 140px; justify-self: stretch; }
/* The fallback drawing is allowed to overflow in the big card; here it must stay inside. */
.today-card.is-side > .stage3d { overflow: hidden; }
.today-card.is-side h2 { gap: 12px; font-size: 1.7rem; }
.today-card.is-side .day-icon { flex-basis: 44px; width: 44px; height: 44px; border-radius: 13px; font-size: 1.25rem; }
.today-card.is-side .ring { width: 78px; height: 78px; }
.streak-home { padding-top: 18px; }
.inbox-card .card-head { margin-bottom: 0; }
.inbox:not(:empty) { display: grid; gap: 4px; margin-top: 12px; }
.inbox-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: inherit; }
.inbox-row:hover { background: var(--bg-2); }
.inbox-row .av { width: 36px; height: 36px; border-radius: 11px; font-size: 0.74rem; }
.inbox-row b { font-size: 0.92rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notification-menu { position: relative; display: block; border-top: 1px solid var(--line); }
.notification-trigger { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 2px; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 0.92rem; font-weight: 600; text-align: left; cursor: pointer; list-style: none; }
.notification-trigger::-webkit-details-marker { display: none; }
.notification-trigger:hover, .notification-menu[open] .notification-trigger { color: var(--ink); }
.notification-trigger .ph-caret-down { margin-left: auto; transition: transform 150ms ease; }
.notification-menu[open] .notification-trigger .ph-caret-down { transform: rotate(180deg); }
.notification-dropdown { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: min(380px, calc(100vw - 32px)); max-height: min(440px, calc(100dvh - 120px)); overflow-y: auto; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); }
.notification-menu:not([open]) .notification-dropdown { display: none; }
.notification-dropdown h3 { margin: 0 0 6px; font-size: 1rem; }
.notification-item:last-child { padding-bottom: 0; }
.notification-empty { margin: 0; }
/* The chain before day one: one line instead of ten empty links. */
.streak-zero { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; color: var(--ink-2); }
.streak-zero i { color: var(--accent-text); font-size: 1.3rem; }
@media (max-width: 1180px) {
    .social.hub { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
    .social.hub .col-feed, .social.hub .col-side { display: contents; }
    .social.hub .col-feed > * + * { margin-top: 0; }
    .social.hub .today-card { order: 1; }
    .social.hub .streak-home { order: 2; }
    .social.hub .storyrow { order: 3; }
    .social.hub .find-card { order: 3; }
    .social.hub .requests { order: 4; }
    .social.hub .notification-menu { order: 2; }
    .social.hub .compose { order: 6; }
    .social.hub .feed-head { order: 7; }
    .social.hub .feed { order: 8; }
}

/* The number under each face on the hub. Faces with and without one line up. */
.friends-row .fr { align-content: start; }
.fr .fr-streak { display: inline-flex; align-items: center; gap: 3px; margin-top: 2px; font-size: 0.72rem; font-weight: 600; color: var(--accent-text); }
.fr .fr-streak i { font-size: 0.8rem; }
.fr .fr-streak.is-risk { color: var(--ink-3); }

/* A link that is switched off for now: grey, not clickable, not in the tab order. */
a.is-off, .nav .links a.is-off, .foot nav a.is-off { color: var(--ink-3); opacity: 0.45; pointer-events: none; cursor: default; text-decoration: none; }
.btn.is-off { opacity: 0.45; pointer-events: none; }

/* The streak on the finish card of a workout. */
.done-streak { width: fit-content; max-width: 100%; margin: 18px auto 0; padding: 14px 18px; border-radius: 14px; background: var(--bg-2); text-align: left; }
.done-streak:empty { display: none; }
.done-streak:has(.chain) { width: min(100%, 380px); }
.done-card.is-fresh { animation: done-rise 520ms cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes done-rise { from { opacity: 0; transform: translateY(24px); } }
.chain i { position: relative; }
.chain-pulse { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; }
.streak-tierup { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-text); }
.done-xp { margin: 14px 0 0; font-weight: 600; color: var(--ink-2); }
.done-xp b { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--accent-text); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .done-card.is-fresh { animation: none; } }

/* ---- Opened from the home screen ----
   The app runs full screen with the status bar laid over the top (its text is
   white), so pages start below it, a dark strip sits behind the clock, and
   nothing slips under the rounded corners. */
@media (display-mode: standalone) {
    body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    html::after { content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 900; height: env(safe-area-inset-top); background: #000000; pointer-events: none; }
}

/* ---- Notices (were notifications.css, loaded late by ui.js) ---- */
.app-notice {
    width: min(440px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-card);
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-lg);
}
.app-notice::backdrop { background: rgba(8, 10, 14, 0.62); backdrop-filter: blur(3px); }
.app-notice__panel { padding: 24px; }
.app-notice__brand { color: var(--accent-text); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; }
.app-notice h2 { margin: 8px 0 0; font-family: var(--font-display); font-size: 1.25rem; line-height: 1.3; }
.app-notice p { margin: 10px 0 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.app-notice__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.app-notice__actions button { min-width: 88px; }
.app-notice__actions [hidden] { display: none; }
.app-notice__actions .btn.is-danger, .app-notice__actions .btn.is-danger:hover { background: var(--bad); color: var(--surface); }
@media (max-width: 480px) {
    .app-notice__panel { padding: 20px; }
    .app-notice__actions button { min-width: 0; }
}
@media (prefers-reduced-motion: no-preference) {
    .app-notice[open] { animation: app-notice-in 140ms ease-out both; }
    @keyframes app-notice-in { from { opacity: 0; transform: translateY(6px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
}

/* ==========================================================================
   Exercise forms, picker and builder (exercise-library.js, exercises.html,
   the Form and Swap row on Today). Both sheets are ordinary .sheet/.sheet-card
   popups, so ui.js turns them into bottom sheets on phones.
   ========================================================================== */

.ex-sheet .sheet-card { overscroll-behavior: contain; --ex-pad: 24px; }
.ex-sheet .sheet-card:focus { outline: none; }
/* The form opens on top of the picker; the second dim is lighter. */
.ex-form-sheet { z-index: 1001; }
.ex-form-sheet.is-stacked { background: rgba(12, 13, 16, calc(0.35 * var(--sheet-dim, 1))); }
@media (min-width: 1081px) {
    .ex-form-sheet .sheet-card { width: min(540px, 100%); }
    .ex-picker .sheet-card { width: min(580px, 100%); height: min(720px, 86vh); }
}
@media (max-width: 1080px) {
    .ex-sheet .sheet-card { --ex-pad: 20px; }
    /* One height while typing, so the sheet does not jump with every letter. */
    html .ex-picker .sheet-card { height: 88dvh; }
}

/* the form sheet: name, muscles, the photos, the steps */
.ex-form-head h3 { margin: 0; overflow-wrap: anywhere; }
.ex-shown { margin: 4px 0 0; font-size: 0.84rem; color: var(--ink-3); }
.ex-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ex-meta:empty { display: none; }
.ex-also { margin: 8px 0 0; font-size: 0.84rem; color: var(--ink-2); }
.ex-form-body { margin-top: 18px; }
.ex-form-body .ex-loading { margin: 0; }
.ex-none { margin: 0 0 6px; font-size: 0.92rem; color: var(--ink-2); }
.ex-fail { padding: 14px 16px; border-radius: 12px; background: var(--bg-2); font-size: 0.9rem; color: var(--ink-2); }
.ex-fail p { margin: 0 0 10px; }

/* Start and end of the movement, one on top of the other. The end photo shows
   for 1.2 s, then the start for 1.2 s: a hard cut, never a fade. */
.ex-photo { position: relative; aspect-ratio: 850 / 567; margin: 0 0 18px; border-radius: 14px; overflow: hidden; background: var(--bg-2); }
.ex-photo figure { position: absolute; inset: 0; margin: 0; }
.ex-photo img { width: 100%; height: 100%; object-fit: cover; }
.ex-photo figcaption { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); background: var(--surface); color: var(--ink); font-size: 0.72rem; font-weight: 600; box-shadow: var(--shadow); }
.ex-photo figure + figure { opacity: 0; }
.ex-photo.is-ready figure + figure { animation: ex-flip 2.4s steps(1, end) infinite; }
@keyframes ex-flip { 0% { opacity: 0; } 50%, 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
    .ex-photo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; aspect-ratio: auto; overflow: visible; border-radius: 0; background: none; }
    .ex-photo figure { position: relative; inset: auto; aspect-ratio: 850 / 567; border-radius: 12px; overflow: hidden; background: var(--bg-2); }
    .ex-photo figure + figure, .ex-photo.is-ready figure + figure { opacity: 1; animation: none; }
}

.ex-steps { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; counter-reset: ex-step; }
.ex-steps li { counter-increment: ex-step; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 12px; font-size: 0.93rem; line-height: 1.55; }
.ex-steps li::before { content: counter(ex-step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); color: var(--ink-2); font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ex-form-sheet .sheet-actions { align-items: center; margin-top: 22px; }
.ex-credit { flex: 1 1 220px; margin: 0; font-size: 0.74rem; line-height: 1.5; color: var(--ink-3); }
.ex-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.ex-credit a:hover { color: var(--ink); }

/* the picker: title, search and parts stay put while the list scrolls under them */
/* It sticks at the card's very top edge, so it carries its own 14px of space above the title. */
.ex-pick-head { position: sticky; top: 0; z-index: 2; margin: -14px calc(-1 * var(--ex-pad)) 0; padding: 14px var(--ex-pad) 12px; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
.ex-pick-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 2px; margin-bottom: 12px; }
.ex-pick-top h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ex-pick-top .sheet-actions { flex: none; margin: 0; }

.ex-search-wrap { position: relative; display: block; }
.ex-search-wrap > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 1.1rem; color: var(--ink-3); pointer-events: none; }
/* 16px: anything smaller and iOS zooms the page when the field is tapped. */
.inp.ex-search { padding-left: 42px; font-size: 16px; }
.ex-search::-webkit-search-decoration { -webkit-appearance: none; }
.ex-parts { margin-top: 12px; }
.ex-parts .filter-chip { flex: none; }
/* In the picker the parts are one row that scrolls sideways, edge to edge. */
.ex-picker .ex-parts { flex-wrap: nowrap; overflow-x: auto; margin: 12px calc(-1 * var(--ex-pad)) 0; padding: 0 var(--ex-pad) 2px; scrollbar-width: none; }
.ex-picker .ex-parts::-webkit-scrollbar { display: none; }

.ex-msg { margin: 18px 0 4px; text-align: center; font-size: 0.92rem; color: var(--ink-2); }
.ex-msg:empty { display: none; }
.ex-msg .btn { margin-top: 10px; }
.ex-results { margin: 6px 0 0; padding: 0; list-style: none; }
.ex-more { display: flex; justify-content: center; margin-top: 14px; }

/* A picker row: the whole row is the choice, with its Form button beside it. */
.ex-item { display: flex; align-items: center; gap: 10px; padding: 0 2px; border-bottom: 1px solid var(--line); }
.ex-item:last-child { border-bottom: 0; }
.ex-item-name { flex: 1 1 auto; align-self: stretch; min-width: 0; display: block; padding: 11px 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ex-item-name b { display: block; font-size: 0.95rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ex-item-name small { display: block; margin-top: 2px; font-size: 0.8rem; line-height: 1.35; color: var(--ink-3); }
.ex-item-name:hover b { text-decoration: underline; text-underline-offset: 3px; }
.ex-item .btn.xs { flex: none; }

/* Form and Swap on a Today card, between the name and "Last time". */
.ex-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; }

/* The Exercise forms page: rows with the start photo, two columns when there is room. */
.ex-library .ex-search-wrap { max-width: 560px; }
.ex-results.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 4px 16px; margin-top: 14px; }
.ex-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.ex-row:hover { background: var(--bg-2); }
.ex-row > .ph { font-size: 1rem; color: var(--ink-3); }
.ex-thumb { display: grid; place-items: center; width: 56px; height: 38px; border-radius: 8px; overflow: hidden; background: var(--bg-2); color: var(--ink-3); font-size: 1.15rem; }
.ex-row:hover .ex-thumb { background: var(--surface); }
.ex-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ex-row-text b { display: block; font-size: 0.95rem; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ex-row-text small { display: block; margin-top: 2px; font-size: 0.8rem; line-height: 1.35; color: var(--ink-3); }
@media (max-width: 600px) {
    .ex-library .ex-parts { flex-wrap: nowrap; overflow-x: auto; margin: 12px -22px 0; padding: 0 22px 2px; scrollbar-width: none; }
    .ex-library .ex-parts::-webkit-scrollbar { display: none; }
}

/* ==========================================================================
   The icon set (icons.js draws an SVG inside an <i class="ph ph-..."> it has
   a file for; the font glyph is hidden). Warm white parts follow the text
   colour, orange is the accent, dark details follow the background; on the
   orange Today disc the accent parts turn dark so the dumbbell stays visible.
   ========================================================================== */
i.ph.has-ico::before { display: none !important; }
i.ph.has-ico { line-height: 1; }
.ico { display: block; width: 1em; height: 1em; --ico-accent: var(--accent); --ico-dark: var(--bg); }
i.has-ico:not([style]) { display: inline-grid; place-items: center; width: 1em; height: 1em; vertical-align: -0.15em; }
.tabbar a.is-today i .ico, .btn.accent .ico { --ico-accent: var(--accent-ink); }
.task-tag .ico, .task-card .ico { --ico-dark: #121212; }
/* The set is drawn for bigger tiles than the font glyphs: a touch larger
   where it carries the navigation. */
.tabbar a i.has-ico, .tabbar button i.has-ico { font-size: 1.6rem; }
.tabbar a.is-today i.has-ico { font-size: 1.75rem; }
.rail a i.has-ico, .rail .item i.has-ico { font-size: 1.3rem; }
.tools-pop i.has-ico, .tools-card i.has-ico { font-size: 2rem; }

/* ==========================================================================
   Daily tasks on Home (tasks.js): the streak, small, then tabs over a deck of
   photo cards with today's training first. The cards keep their own dark
   photo look in both themes; everything around them follows the theme and
   the accent. Finishing a task plays a short animation (below).
   ========================================================================== */
.tasks { --task-lift: 0 -6px 16px rgba(21, 22, 26, 0.22); display: grid; gap: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tasks { --task-lift: 0 -10px 24px rgba(0, 0, 0, 0.75); } }
:root[data-theme="dark"] .tasks { --task-lift: 0 -10px 24px rgba(0, 0, 0, 0.75); }
@media (max-width: 1180px) { .social.hub .tasks { order: 1; } }
/* On short desktop screens the task deck is taller than the window, so the
   side column scrolls with the page instead of sticking. */
@media (min-width: 1181px) and (max-height: 760px) { .social.hub .col-side { position: static; } }

.tasks-streak { padding: 14px 16px; }
.tasks-streak .streak-chain { gap: 10px; }
.tasks-streak .streak-top { gap: 10px; }
.tasks-streak .streak-flame { width: 34px; height: 34px; border-radius: 10px; font-size: 1.45rem; }
.tasks-streak .streak-count { display: flex; align-items: baseline; gap: 7px; }
.tasks-streak .streak-count b { font-size: 1.6rem; }
.tasks-streak .streak-count span { margin: 0; }
.tasks-streak .chain { gap: 5px; }
.tasks-risk { margin: 10px 0 0; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }

.task-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.task-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 0.88rem; font-weight: 600; line-height: 1; cursor: pointer; }
.task-tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.task-tabs small { font-size: 0.76em; line-height: 1; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* A flex column (not a grid): a folding card's negative margin can then close
   the gap it leaves, so the cards below slide up without a jump at the end. */
.task-list { display: flex; flex-direction: column; }
.task-empty { margin: 0; padding: 26px 16px; border: 1px dashed var(--line-2); border-radius: 12px; text-align: center; font-size: 0.92rem; color: var(--ink-3); }
.task-list .task-card + .task-empty { margin-top: 12px; }

/* Each card is its own layer, so what is drawn inside it (the finish light,
   the tick) stays under the next card where the deck overlaps. */
.task-card { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 148px; padding: 16px 16px 18px; border-radius: 12px; background: #121212; color: #fff; box-shadow: var(--task-lift); text-decoration: none; }
/* Stacked like a deck: each card slides up over the one above. */
.task-card + .task-card { margin-top: -12px; }
.task-art { position: absolute; inset: 0; }
.task-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.35) 45%, rgba(0, 0, 0, 0.85) 100%); }
.task-photo { display: block; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.75) brightness(0.8); }
.task-icon { display: grid; place-items: center; justify-items: end; width: 100%; height: 100%; padding-right: 22px; background: radial-gradient(90% 120% at 85% 20%, color-mix(in srgb, var(--tone) 70%, #000) 0%, #0c0c0c 75%); color: color-mix(in srgb, var(--tone) 60%, #fff); font-size: 7rem; }
.task-icon i { opacity: 0.35; transform: rotate(-12deg); }
.task-check { position: absolute; z-index: 2; top: calc(50% - 17px); right: 14px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1.5px solid rgba(255, 255, 255, 0.75); border-radius: 7px; background: rgba(255, 255, 255, 0.12); color: #0a0a0a; font-size: 1.05rem; cursor: pointer; }
.task-check i { opacity: 0; }
.task-card.is-done .task-check, .task-card.is-finishing .task-check { background: #fff; border-color: #fff; }
.task-card.is-done .task-check i, .task-card.is-finishing .task-check i { opacity: 1; }
.task-card.is-done, .task-card.is-skipped { opacity: 0.7; }
.task-open { position: relative; display: block; width: 100%; padding: 0 54px 0 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.task-title { margin: 0; font-family: var(--font-display); font-stretch: 112%; font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.05; color: #fff; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; font-size: 0.76rem; font-weight: 600; color: #d8d8d8; }
.task-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.task-meta > span + span::before { content: ""; width: 1px; height: 10px; margin-right: 8px; background: rgba(255, 255, 255, 0.35); }
/* On the always-dark cards the accent is lifted toward white, so cobalt and
   custom colours stay readable. */
.task-xp { color: color-mix(in srgb, var(--accent) 55%, #fff); }
.task-bar { position: absolute; left: 0; right: 0; bottom: 0; display: block; height: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.12); }
.task-bar i { display: block; height: 100%; background: #fff; }

/* Today's training: the same card with a Training tag and a thin white
   outline, bright at the top-left and bottom-right corners and fading out
   toward the middle of each edge. Tapping it opens the workout. */
.task-card.is-training { border: 1.5px solid transparent; background: linear-gradient(#121212, #121212) padding-box, linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.45) 28%, rgba(255, 255, 255, 0) 48%, rgba(255, 255, 255, 0) 56%, rgba(255, 255, 255, 0.45) 76%, rgba(255, 255, 255, 0.9) 100%) border-box; }
.task-tag { position: absolute; z-index: 1; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.task-go { pointer-events: none; color: #fff; }
.task-go i { opacity: 1; }
.task-card.is-training.is-done .task-go { color: #0a0a0a; }
.task-card.is-training .task-meta > span:first-child { color: #fff; }
.task-card.is-loading { min-height: 96px; pointer-events: none; }
.task-card.is-loading .task-meta { color: #8a8a8a; }

.task-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 60; margin: 0; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 0.86rem; font-weight: 600; white-space: nowrap; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.task-toast.on { opacity: 1; transform: translate(-50%, 0); }

.task-sheet-body { display: grid; gap: 12px; }
.task-sheet-art { position: relative; height: 140px; border-radius: 12px; overflow: hidden; }
.task-sheet h3 { margin: 4px 0 0; }
.task-sheet-meta { margin: 0; font-size: 0.86rem; color: var(--ink-2); }
.task-sheet-goal { display: grid; gap: 8px; }
.task-sheet-goal .task-bar { position: static; height: 6px; border-radius: 999px; background: var(--line); }
.task-sheet-goal .task-bar i { background: var(--accent); }

/* ---- finishing a task ----
   tasks.js adds .is-finishing to the card and draws the burst and "+XP" in a
   fixed layer over the page (.task-fx, so the card does not clip them), then
   folds the card away. */
.task-card.is-finishing { pointer-events: none; }
.task-card.is-finishing .task-check { animation: task-pop 0.42s cubic-bezier(0.3, 1.6, 0.5, 1); }
.task-card.is-finishing .task-check i { animation: task-draw 0.3s 0.08s ease-out both; }
.task-card.is-finishing .task-bar i { width: 100% !important; transition: width 0.45s cubic-bezier(0.3, 0.8, 0.3, 1); }
/* A light passing over the card. */
.task-card.is-finishing::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%); transform: translateX(-100%); animation: task-sheen 0.65s 0.05s ease-out forwards; }

.task-fx { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.task-burst { position: absolute; width: 0; height: 0; }
.task-burst b { position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent) 55%, #fff); animation: task-ring 0.7s cubic-bezier(0.25, 0.6, 0.35, 1) forwards; }
.task-burst i { position: absolute; left: -2px; top: -7px; width: 4px; height: 14px; border-radius: 2px; background: var(--accent); opacity: 0; animation: task-spark 0.7s 0.05s ease-out forwards; }
.task-burst i:nth-child(odd) { background: color-mix(in srgb, var(--accent) 45%, #fff); }
.task-xpfly { position: absolute; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-display); font-stretch: 108%; font-weight: 800; font-size: 0.92rem; white-space: nowrap; opacity: 0; animation: task-xp 1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
.task-confetti { position: absolute; top: 0; width: 7px; height: 12px; border-radius: 2px; background: var(--accent); }
.task-confetti.c1 { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-strong); }
.task-confetti.c2 { background: var(--ink); }
.task-confetti.c3 { width: 5px; height: 14px; background: color-mix(in srgb, var(--accent) 50%, #fff); }

/* The Done count pops when a card lands there; every task done lights up the
   streak card. */
.task-tabs small.bump { display: inline-block; animation: task-bump 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
.tasks-streak.is-cheer { animation: task-cheer 1.4s ease-out; }
.tasks-streak.is-cheer .streak-flame { animation: task-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) 2; }

@keyframes task-pop { 0% { transform: scale(0.7); } 55% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes task-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes task-sheen { to { transform: translateX(100%); } }
@keyframes task-ring { from { transform: scale(0.4); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes task-spark {
    0% { transform: rotate(var(--a)) translateY(-16px) scaleY(0.4); opacity: 1; }
    35% { transform: rotate(var(--a)) translateY(-32px) scaleY(1); opacity: 1; }
    100% { transform: rotate(var(--a)) translateY(-48px) scaleY(0.2); opacity: 0; }
}
@keyframes task-xp {
    0% { transform: translate(-50%, -100%) scale(0.6); opacity: 0; }
    18% { transform: translate(-50%, -150%) scale(1.1); opacity: 1; }
    70% { opacity: 1; }
    100% { transform: translate(-50%, -300%) scale(1); opacity: 0; }
}
@keyframes task-bump { 0% { transform: scale(1); } 40% { transform: scale(1.7); } 100% { transform: scale(1); } }
@keyframes task-cheer {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 75%, transparent); }
    100% { box-shadow: 0 0 0 20px color-mix(in srgb, var(--accent) 0%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .task-tabs small.bump, .tasks-streak.is-cheer, .tasks-streak.is-cheer .streak-flame { animation: none; }
    .task-toast { transition: none; }
}
