/* ==========================================================================
   Personal Trainer Forge — stylesheet
   Mobile-first. Everything below 380px still works; everything above 1100px
   just gets more breathing room.
   ========================================================================== */

:root {
    --bg: #0c1220;
    --bg-2: #101a2d;
    --surface: #16223a;
    --surface-2: #1b2a45;
    --surface-3: #22334f;
    --border: #27385a;
    --border-soft: #1f2e4a;

    --text: #eaf0fb;
    --muted: #94a4c2;
    --faint: #6d7d9c;

    --lime: #a3e635;
    --amber: #fbbf24;
    --sky: #38bdf8;
    --rose: #fb7185;
    --mint: #34d399;
    --orange: #fb923c;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 18px 40px rgba(0, 0, 0, .45);
    --ring: 0 0 0 3px rgba(163, 230, 53, .35);

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --display: 'Barlow Condensed', 'Inter', system-ui, sans-serif;

    --tap: 44px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 7.5rem;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(900px 520px at 8% -6%, rgba(163, 230, 53, .10), transparent 60%),
        radial-gradient(800px 600px at 96% 2%, rgba(56, 189, 248, .10), transparent 55%),
        radial-gradient(700px 700px at 50% 118%, rgba(251, 146, 60, .08), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* Fieldsets default to min-inline-size: min-content and refuse to shrink,
   which breaks the layout on narrow phones. */
fieldset {
    min-inline-size: 0;
}

a {
    color: var(--lime);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: #c6f16a;
}

ul {
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--lime);
    outline-offset: 2px;
    border-radius: 6px;
}

.sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    background: var(--lime);
    color: #0b1220;
    padding: .7rem 1.1rem;
    border-radius: 0 0 10px 0;
    font-weight: 700;
}

.skip-link:focus {
    left: 0;
}

.shell {
    width: min(100% - 1.75rem, 1120px);
    margin-inline: auto;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(12, 18, 32, .86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    min-height: 56px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
    font-family: var(--display);
    font-size: clamp(1rem, 4.4vw, 1.25rem);
    letter-spacing: .02em;
    text-transform: uppercase;
}

.brand-glyph {
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.brand-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-long {
    display: none;
}

.brand strong {
    color: var(--lime);
}

.topbar-back {
    flex: 0 0 auto;
    font-size: .85rem;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
    padding: .5rem 0 .5rem .5rem;
}

.topbar-back:hover {
    color: var(--text);
}

/* -------------------------------------------------------------------- hero */

.hero {
    padding: clamp(2rem, 7vw, 4rem) 0 clamp(1.25rem, 3vw, 2rem);
}

.eyebrow {
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--lime);
    margin-bottom: .6rem;
}

h1 {
    font-family: var(--display);
    font-size: clamp(2.1rem, 8.5vw, 4rem);
    line-height: 1.02;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    background: linear-gradient(100deg, #fff 10%, var(--lime) 55%, var(--sky));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 16ch;
}

.lede {
    margin-top: .9rem;
    max-width: 62ch;
    color: var(--muted);
    font-size: clamp(.97rem, 2.4vw, 1.06rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
    margin-top: 1.4rem;
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 1.4rem;
    margin-top: 1.6rem;
    color: var(--faint);
    font-size: .85rem;
}

.hero-facts strong {
    display: block;
    font-family: var(--display);
    font-size: 1.65rem;
    color: var(--text);
    line-height: 1;
}

/* ------------------------------------------------------------------ button */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: var(--tap);
    padding: .65rem 1.15rem;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 650;
    font-size: .94rem;
    cursor: pointer;
    text-decoration: none;
    transition: transform .12s ease, background .18s ease, border-color .18s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(100deg, var(--lime), #7fd41c);
    color: #0b1220;
}

.btn-primary:hover {
    background: linear-gradient(100deg, #b6ef52, var(--lime));
    color: #0b1220;
}

.btn-ghost {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-3);
    color: var(--text);
}

.btn-danger {
    background: transparent;
    border-color: rgba(251, 113, 133, .45);
    color: var(--rose);
}

.btn-danger:hover {
    background: rgba(251, 113, 133, .12);
    color: var(--rose);
}

.btn-sm {
    min-height: 38px;
    padding: .4rem .85rem;
    font-size: .84rem;
}

.btn-big {
    min-height: 52px;
    font-size: 1.02rem;
    padding: .8rem 1.5rem;
}

.full {
    width: 100%;
    margin-top: 1.1rem;
}

.linkish {
    background: none;
    border: 0;
    color: var(--lime);
    font-weight: 600;
    cursor: pointer;
    padding: .35rem 0;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* -------------------------------------------------------------------- tabs */

.tabs {
    position: sticky;
    top: 55px;
    z-index: 30;
    background: rgba(12, 18, 32, .92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-block: 1px solid var(--border-soft);
    margin-bottom: 1.4rem;
}

.tabs-inner {
    display: flex;
    gap: .35rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding: .45rem 0;
}

.tabs-inner::-webkit-scrollbar {
    display: none;
}

.tab {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 42px;
    padding: .5rem .65rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 600;
    font-size: .86rem;
    white-space: nowrap;
    cursor: pointer;
}

.tab.is-on {
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text);
    box-shadow: inset 0 0 0 1px rgba(163, 230, 53, .18);
}

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

.card {
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1rem, 3.4vw, 1.5rem);
    box-shadow: var(--shadow);
}

.view {
    padding-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.view-head {
    margin-bottom: .25rem;
}

.view-head h2,
.guide h2 {
    font-family: var(--display);
    font-size: clamp(1.7rem, 5.6vw, 2.4rem);
    text-transform: uppercase;
    letter-spacing: .01em;
    line-height: 1.1;
}

.view-head p {
    color: var(--muted);
    margin-top: .3rem;
    max-width: 62ch;
}

.card-title,
.summary-title {
    font-family: var(--display);
    font-size: 1.3rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin-bottom: .7rem;
}

.empty-state {
    text-align: center;
    padding: clamp(2rem, 8vw, 3.5rem) 1rem;
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state h2 {
    font-family: var(--display);
    font-size: 1.8rem;
    text-transform: uppercase;
}

.empty-state p {
    color: var(--muted);
    max-width: 46ch;
    margin: .6rem auto 1.2rem;
}

.empty-alt {
    font-size: .88rem;
    margin-top: 1.2rem !important;
    margin-bottom: 0 !important;
}

.empty-note {
    color: var(--muted);
    padding: 1.5rem 0;
}

/* ------------------------------------------------------------------ forge */

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.step {
    border: 1px solid var(--border);
}

.step-title {
    font-family: var(--display);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .55rem;
    margin-bottom: .9rem;
}

.step-n {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--lime);
    color: #0b1220;
    font-size: .88rem;
    font-family: var(--font);
    font-weight: 800;
    flex: 0 0 auto;
}

.optional {
    font-family: var(--font);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: .1rem .5rem;
}

.goal-grid {
    display: grid;
    gap: .7rem;
    grid-template-columns: 1fr;
}

.goal-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    text-align: left;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .9rem 1rem;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, transform .12s ease;
}

.goal-card:hover {
    border-color: rgba(163, 230, 53, .5);
}

.goal-card.is-on {
    border-color: var(--lime);
    background: linear-gradient(180deg, rgba(163, 230, 53, .12), var(--surface-2));
    box-shadow: inset 0 0 0 1px rgba(163, 230, 53, .35);
}

.goal-top {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.goal-glyph {
    font-size: 1.6rem;
    line-height: 1;
    flex: 0 0 auto;
}

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

.goal-name {
    font-family: var(--display);
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: .01em;
    line-height: 1.1;
}

.goal-short {
    font-size: .76rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--lime);
    font-weight: 600;
}

.goal-blurb {
    color: var(--muted);
    font-size: .9rem;
}

.why {
    margin-top: .9rem;
    padding: .8rem .95rem;
    background: rgba(56, 189, 248, .07);
    border-left: 3px solid var(--sky);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
    font-size: .9rem;
}

.why strong {
    color: var(--sky);
}

.chip-row {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .2rem;
}

.chip-row::-webkit-scrollbar {
    display: none;
}

.chip-row.wrap {
    flex-wrap: wrap;
    overflow: visible;
}

.chip {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    min-height: var(--tap);
    min-width: 84px;
    padding: .5rem .8rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.chip:hover {
    border-color: rgba(163, 230, 53, .45);
}

.chip.is-on {
    border-color: var(--lime);
    background: rgba(163, 230, 53, .14);
}

.chip-label {
    font-weight: 650;
    font-size: .92rem;
    white-space: nowrap;
}

.chip-note {
    font-size: .7rem;
    color: var(--faint);
    white-space: nowrap;
}

.chip.is-on .chip-note {
    color: var(--muted);
}

.chip-sm {
    flex: 0 0 auto;
    min-width: 0;
    min-height: 38px;
    padding: .4rem .8rem;
}

.chip-sm .chip-label {
    font-size: .85rem;
}

.field-label {
    display: block;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 1rem 0 .45rem;
}

.step-title+.field-label {
    margin-top: 0;
}

.kit-grid {
    display: grid;
    gap: .6rem;
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
}

.kit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: .15rem;
    min-height: var(--tap);
    padding: .75rem .85rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
}

.kit:hover {
    border-color: rgba(163, 230, 53, .45);
}

.kit.is-on {
    border-color: var(--lime);
    background: rgba(163, 230, 53, .13);
}

.kit.is-locked {
    opacity: .8;
    cursor: default;
}

.kit-glyph {
    font-size: 1.25rem;
    line-height: 1;
}

.kit-name {
    font-weight: 650;
    font-size: .92rem;
}

.kit-note {
    font-size: .74rem;
    color: var(--faint);
}

.input {
    width: 100%;
    min-height: var(--tap);
    padding: .6rem .8rem;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
}

.input::placeholder {
    color: var(--faint);
}

.input:focus {
    border-color: var(--lime);
    outline: none;
    box-shadow: var(--ring);
}

.input.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .82rem;
    line-height: 1.5;
    resize: vertical;
}

.two-col {
    display: grid;
    gap: .8rem;
    grid-template-columns: 1fr;
    margin-top: .4rem;
}

.hint {
    color: var(--faint);
    font-size: .84rem;
    margin-top: .8rem;
}

.hint.centred {
    text-align: center;
}

.summary {
    border-color: rgba(163, 230, 53, .3);
}

.summary-grid,
.stat-row {
    display: grid;
    gap: .55rem;
    grid-template-columns: repeat(auto-fit, minmax(min(96px, 100%), 1fr));
}

.stat-row {
    margin-top: 1rem;
}

.stat {
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: .6rem .5rem;
    text-align: center;
    min-width: 0;
}

.stat-v {
    display: block;
    font-family: var(--display);
    font-size: 1.35rem;
    line-height: 1.15;
    color: var(--text);
    overflow-wrap: anywhere;
}

.stat-k {
    display: block;
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-top: .15rem;
}

.summary-note {
    margin-top: .9rem;
    color: var(--lime);
    font-size: .9rem;
}

.summary-line {
    margin-top: .35rem;
    color: var(--muted);
    font-size: .85rem;
}

.forge-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .7rem;
}

.forge-actions .btn-big {
    flex: 1 1 240px;
}

/* -------------------------------------------------------------- today view */

.kicker {
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--lime);
}

.today-head {
    border-color: rgba(163, 230, 53, .28);
}

.today-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .8rem;
}

.today-name {
    font-family: var(--display);
    font-size: clamp(1.5rem, 5.4vw, 2.1rem);
    text-transform: uppercase;
    line-height: 1.1;
    margin-top: .15rem;
    overflow-wrap: anywhere;
}

.bar {
    height: 8px;
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
    margin-top: .9rem;
}

.bar-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--lime), var(--sky));
    border-radius: 999px;
    transition: width .4s ease;
}

.notice {
    margin-top: .9rem;
    padding: .75rem .9rem;
    border-radius: var(--radius-sm);
    font-size: .92rem;
}

.notice-info {
    background: rgba(56, 189, 248, .1);
    border-left: 3px solid var(--sky);
    color: var(--text);
}

.notice-good {
    background: rgba(52, 211, 153, .1);
    border-left: 3px solid var(--mint);
    color: var(--text);
}

.notice-card {
    border-color: rgba(251, 191, 36, .38);
    background: linear-gradient(180deg, rgba(251, 191, 36, .09), var(--bg-2));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .8rem;
}

.notice-card p {
    flex: 1 1 240px;
    font-size: .92rem;
    color: var(--text);
}

.day-card {
    border-color: rgba(163, 230, 53, .25);
}

.day-card.day-rest,
.day-card.day-active,
.day-card.day-walk {
    border-color: rgba(56, 189, 248, .3);
}

.day-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .7rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--border-soft);
}

.day-title {
    font-family: var(--display);
    font-size: clamp(1.45rem, 5.2vw, 2rem);
    text-transform: uppercase;
    line-height: 1.1;
    margin-top: .1rem;
}

.day-focus {
    color: var(--muted);
    font-size: .92rem;
    margin-top: .2rem;
}

.day-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.tag {
    display: inline-block;
    padding: .22rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: rgba(163, 230, 53, .16);
    color: var(--lime);
    white-space: nowrap;
}

.tag-quiet {
    background: var(--surface-3);
    color: var(--muted);
}

.tag-now {
    background: var(--lime);
    color: #0b1220;
}

.tag-done {
    background: rgba(52, 211, 153, .2);
    color: var(--mint);
}

.tag-edit {
    background: rgba(251, 191, 36, .18);
    color: var(--amber);
}

/* Swap-this-exercise ------------------------------------------------------- */
.ex-swap {
    position: relative;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin-top: .1rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease;
}

.ex-swap::after {
    content: '';
    position: absolute;
    inset: -8px;
}

.ex-swap:hover {
    color: var(--lime);
    border-color: rgba(163, 230, 53, .5);
}

/* Day-level actions -------------------------------------------------------- */
.day-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid var(--border-soft);
}

.day-actions .btn {
    flex: 1 1 auto;
}

.day-actions-inline {
    margin: 0 .8rem .9rem;
    padding-top: .7rem;
}

.day-options {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    margin-top: 1rem;
}

.day-option-head {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin: .9rem 0 .1rem;
}

.day-option {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    width: 100%;
    min-height: var(--tap);
    padding: .65rem .8rem;
    text-align: left;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease;
}

.day-option:hover {
    border-color: rgba(163, 230, 53, .5);
}

.day-option.is-on {
    border-color: var(--lime);
    background: rgba(163, 230, 53, .12);
}

.day-option-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
}

.day-option-name {
    font-weight: 650;
    font-size: .95rem;
    min-width: 0;
}

.day-option-sub {
    font-size: .82rem;
    color: var(--muted);
}

.phase-note {
    margin-top: .9rem;
    color: var(--muted);
    font-size: .88rem;
    font-style: italic;
}

.blocks {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.1rem;
}

.block-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .6rem;
}

.block-name {
    font-family: var(--display);
    font-size: 1.1rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text);
}

.block-warmup .block-name {
    color: var(--amber);
}

.block-cooldown .block-name {
    color: var(--sky);
}

.block-mins {
    font-size: .75rem;
    color: var(--faint);
    white-space: nowrap;
}

.block-note {
    color: var(--faint);
    font-size: .82rem;
    margin-top: .15rem;
}

.ex-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .7rem;
}

.ex {
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: .7rem .8rem;
}

.ex.is-done {
    opacity: .55;
}

.ex.is-done .ex-name {
    text-decoration: line-through;
}

.ex-head {
    display: flex;
    align-items: flex-start;
    gap: .7rem;
}

.tick {
    position: relative;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin-top: .1rem;
    border-radius: 9px;
    border: 2px solid var(--border);
    background: transparent;
    color: #0b1220;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}

/* Invisible 48px hit area so it is thumb-friendly without a taller row. */
.tick::after {
    content: '';
    position: absolute;
    inset: -8px;
}

.tick.is-on {
    background: var(--lime);
    border-color: var(--lime);
}

.ex-main {
    display: flex;
    flex-direction: column;
    gap: .28rem;
    min-width: 0;
    flex: 1 1 auto;
}

.ex-name {
    font-weight: 650;
    font-size: .98rem;
    overflow-wrap: anywhere;
}

.ex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.pill {
    display: inline-block;
    padding: .16rem .5rem;
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: .74rem;
    font-weight: 600;
    white-space: nowrap;
}

.pill-strong {
    background: rgba(163, 230, 53, .16);
    color: var(--lime);
}

.ex-detail {
    font-size: .84rem;
    color: var(--muted);
}

.ex-note {
    color: var(--amber);
}

.ex-more {
    margin-top: .5rem;
}

.ex-more summary {
    cursor: pointer;
    font-size: .78rem;
    color: var(--faint);
    letter-spacing: .05em;
    text-transform: uppercase;
    font-weight: 600;
    padding: .6rem 0;
    list-style: none;
}

.ex-more summary::-webkit-details-marker {
    display: none;
}

.ex-more summary::before {
    content: '▸ ';
}

.ex-more[open] summary::before {
    content: '▾ ';
}

.ex-cue {
    font-size: .87rem;
    color: var(--muted);
    padding: .3rem 0;
}

.ex-cue-inline {
    font-size: .82rem;
    padding: .35rem 0 0;
}

.ex-scale {
    font-size: .84rem;
    color: var(--faint);
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding-top: .2rem;
}

.ex-scale strong {
    color: var(--muted);
}

.rest-body {
    margin-top: 1rem;
}

.rest-lead {
    color: var(--text);
}

.tip {
    margin-top: .8rem;
    padding: .8rem .95rem;
    background: rgba(56, 189, 248, .08);
    border-left: 3px solid var(--sky);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
    font-size: .9rem;
}

.mini-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    margin-bottom: .8rem;
}

.mini {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: .9rem;
}

.mini-day {
    font-family: var(--display);
    text-transform: uppercase;
    color: var(--lime);
    font-size: 1rem;
}

.mini-rest .mini-day,
.mini-active .mini-day,
.mini-walk .mini-day {
    color: var(--sky);
}

.mini-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-date {
    color: var(--faint);
    font-size: .78rem;
    white-space: nowrap;
}

/* --------------------------------------------------------------- plan view */

.plan-meta {
    color: var(--muted);
    font-size: .9rem;
    margin-top: .3rem;
}

.plan-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1.1rem;
}

.week {
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .35rem .9rem .9rem;
}

.week.is-current {
    border-color: rgba(163, 230, 53, .45);
}

.week-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .7rem;
    cursor: pointer;
    padding: .75rem .1rem;
    list-style: none;
}

.week-head::-webkit-details-marker {
    display: none;
}

.week-label {
    display: flex;
    align-items: center;
    gap: .55rem;
    flex-wrap: wrap;
}

.week-n {
    font-family: var(--display);
    font-size: 1.25rem;
    text-transform: uppercase;
}

.week-phase {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
}

.phase-base {
    background: rgba(56, 189, 248, .18);
    color: var(--sky);
}

.phase-build {
    background: rgba(163, 230, 53, .18);
    color: var(--lime);
}

.phase-peak {
    background: rgba(251, 146, 60, .2);
    color: var(--orange);
}

.phase-deload {
    background: rgba(148, 164, 194, .18);
    color: var(--muted);
}

.phase-steady {
    background: rgba(52, 211, 153, .16);
    color: var(--mint);
}

.week-stat {
    font-size: .8rem;
    color: var(--faint);
    white-space: nowrap;
}

.week-note {
    color: var(--muted);
    font-size: .86rem;
    font-style: italic;
    padding: 0 .1rem .6rem;
}

.vol-wrap {
    padding: .2rem .1rem .8rem;
}

.vol-title {
    font-size: .7rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: .4rem;
}

.vol-list {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.vol {
    display: inline-flex;
    gap: .35rem;
    align-items: baseline;
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: .2rem .65rem;
    font-size: .78rem;
}

.vol-m {
    text-transform: capitalize;
    color: var(--muted);
}

.vol-n {
    color: var(--lime);
    font-weight: 700;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

.day-det {
    background: var(--bg-2);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.day-row.is-today .day-det {
    border-color: var(--lime);
}

.day-sum {
    display: grid;
    grid-template-columns: 3.2rem 1fr auto;
    align-items: center;
    gap: .7rem;
    padding: .7rem .8rem;
    cursor: pointer;
    list-style: none;
    min-height: var(--tap);
}

.day-sum::-webkit-details-marker {
    display: none;
}

.day-when {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.day-wd {
    font-family: var(--display);
    text-transform: uppercase;
    font-size: 1rem;
    color: var(--text);
}

.day-row.day-rest .day-wd,
.day-row.day-active .day-wd,
.day-row.day-walk .day-wd {
    color: var(--faint);
}

.day-dt {
    font-size: .7rem;
    color: var(--faint);
}

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

.day-t {
    font-weight: 600;
    font-size: .92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-f {
    font-size: .76rem;
    color: var(--faint);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-det .blocks {
    padding: 0 .8rem .9rem;
    margin-top: .2rem;
}

.day-det .rest-body {
    padding: 0 .8rem .9rem;
    margin-top: 0;
    color: var(--muted);
    font-size: .88rem;
}

/* ------------------------------------------------------------ library view */

.lib-controls {
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.lib-count {
    color: var(--faint);
    font-size: .82rem;
}

.lib-grid {
    display: grid;
    gap: .8rem;
    grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
}

.lib-card {
    padding: 1rem;
}

.lib-top {
    display: flex;
    flex-direction: column;
    gap: .45rem;
}

.lib-name {
    font-family: var(--display);
    font-size: 1.2rem;
    text-transform: uppercase;
    line-height: 1.15;
}

.lib-badges {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
}

.pill-push {
    background: rgba(251, 146, 60, .18);
    color: var(--orange);
}

.pill-pull {
    background: rgba(56, 189, 248, .18);
    color: var(--sky);
}

.pill-squat,
.pill-hinge,
.pill-lunge {
    background: rgba(163, 230, 53, .16);
    color: var(--lime);
}

.pill-core,
.pill-carry {
    background: rgba(251, 191, 36, .18);
    color: var(--amber);
}

.pill-cardio {
    background: rgba(251, 113, 133, .18);
    color: var(--rose);
}

.pill-mobility {
    background: rgba(52, 211, 153, .16);
    color: var(--mint);
}

.pill-lvl-3 {
    background: rgba(251, 113, 133, .16);
    color: var(--rose);
}

.lib-cue {
    color: var(--muted);
    font-size: .88rem;
    margin-top: .7rem;
}

.lib-muscles {
    margin-top: .5rem;
    font-size: .74rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--faint);
}

.lib-card .ex-scale {
    margin-top: .6rem;
}

/* ------------------------------------------------------------------ guide */

.guide {
    padding: clamp(2rem, 7vw, 4rem) 0 3rem;
    border-top: 1px solid var(--border-soft);
    background: linear-gradient(180deg, rgba(22, 34, 58, .35), transparent 40%);
}

.guide-grid,
.goal-explainers {
    display: grid;
    gap: .85rem;
    grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
    margin-top: 1.4rem;
}

.guide-card h3,
.explainer-head {
    font-family: var(--display);
    font-size: 1.25rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.guide-card p,
.explainer p {
    color: var(--muted);
    font-size: .92rem;
}

.guide-card em,
.explainer em {
    color: var(--lime);
    font-style: normal;
    font-weight: 600;
}

.explainer-short {
    font-size: .74rem !important;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--lime) !important;
    margin-bottom: .5rem;
}

.explainer-rule {
    margin-top: .7rem;
    padding-top: .7rem;
    border-top: 1px solid var(--border-soft);
    color: var(--text) !important;
    font-size: .86rem !important;
}

.sub-title {
    font-family: var(--display);
    font-size: clamp(1.4rem, 4.6vw, 1.9rem);
    text-transform: uppercase;
    letter-spacing: .02em;
    margin: 2.6rem 0 .2rem;
}

.faq {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: 1.2rem;
}

.faq details {
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .2rem 1rem;
}

.faq summary {
    cursor: pointer;
    padding: .85rem .2rem;
    font-weight: 650;
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: .8rem;
    min-height: var(--tap);
    align-items: center;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: '+';
    color: var(--lime);
    font-size: 1.3rem;
    line-height: 1;
    flex: 0 0 auto;
}

.faq details[open] summary::after {
    content: '–';
}

.faq p {
    color: var(--muted);
    font-size: .92rem;
    padding: 0 .2rem 1rem;
}

.sources-intro {
    color: var(--muted);
    margin-top: 1rem;
    max-width: 68ch;
}

.sources {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    margin-top: 1rem;
}

.sources li {
    padding-left: 1.1rem;
    position: relative;
    color: var(--muted);
    font-size: .9rem;
}

.sources li::before {
    content: '▪';
    position: absolute;
    left: 0;
    color: var(--lime);
}

.sources strong {
    color: var(--text);
}

.disclaimer {
    margin-top: 1.6rem;
    padding: .9rem 1rem;
    background: rgba(251, 113, 133, .08);
    border-left: 3px solid var(--rose);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
    font-size: .88rem;
}

.disclaimer strong {
    color: var(--rose);
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .85em;
    background: var(--surface-3);
    padding: .1rem .35rem;
    border-radius: 5px;
}

/* ----------------------------------------------------------------- footer */

.site-foot {
    border-top: 1px solid var(--border-soft);
    padding: 1.8rem 0 calc(2rem + env(safe-area-inset-bottom));
    text-align: center;
    color: var(--muted);
    font-size: .88rem;
}

.site-foot .muted {
    color: var(--faint);
    margin-top: .3rem;
    font-size: .82rem;
}

/* ---------------------------------------------------------------- dialogs */

.sheet {
    width: min(100% - 1.5rem, 540px);
    max-height: 90dvh;
    margin: auto;
    padding: clamp(1.1rem, 4vw, 1.6rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, var(--surface), var(--bg-2));
    color: var(--text);
    box-shadow: var(--shadow);
    overflow: auto;
}

.sheet::backdrop {
    background: rgba(6, 10, 20, .72);
    backdrop-filter: blur(3px);
}

.sheet h2 {
    font-family: var(--display);
    font-size: 1.6rem;
    text-transform: uppercase;
    padding-right: 2.5rem;
}

.sheet-sub {
    color: var(--muted);
    font-size: .9rem;
    margin-top: .4rem;
}

.sheet-close-form {
    float: right;
}

.sheet-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--muted);
    cursor: pointer;
    font-size: 1rem;
}

.sheet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1.1rem 0;
}

.sheet-actions .btn {
    flex: 1 1 auto;
}

.import-msg {
    font-size: .86rem;
    color: var(--muted);
    min-height: 1.2em;
}

.import-msg.is-bad {
    color: var(--rose);
}

/* ------------------------------------------------------------------ toast */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.25rem + env(safe-area-inset-bottom));
    transform: translate(-50%, 120%);
    z-index: 90;
    max-width: min(92vw, 420px);
    padding: .7rem 1.1rem;
    background: var(--lime);
    color: #0b1220;
    font-weight: 650;
    font-size: .9rem;
    border-radius: 999px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transition: transform .28s cubic-bezier(.22, 1, .36, 1), opacity .28s ease;
    text-align: center;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

/* --------------------------------------------------------------- breakpoints */

@media (min-width: 620px) {
    .goal-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .two-col {
        grid-template-columns: 1fr 1fr;
    }

    .mini {
        grid-template-columns: 3.5rem 1fr auto;
    }

    .brand-long {
        display: inline;
    }

    .tab {
        padding: .5rem .9rem;
        font-size: .9rem;
    }
}

@media (min-width: 900px) {
    .goal-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .tabs {
        top: 57px;
    }

    .tabs-inner {
        gap: .5rem;
    }

    .tab {
        flex: 0 0 auto;
    }
}

/* Very small phones — keep everything readable and inside the viewport. */
@media (max-width: 380px) {
    .shell {
        width: calc(100% - 1.1rem);
    }

    .card {
        padding: .85rem;
    }

    .stat-v {
        font-size: 1.15rem;
    }

    .day-sum {
        grid-template-columns: 2.8rem 1fr auto;
        gap: .5rem;
    }

    .hero-facts {
        gap: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

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

@media print {

    .topbar,
    .tabs,
    .hero,
    .guide,
    .site-foot,
    .plan-actions,
    .toast,
    .sheet,
    .btn,
    .ex-more,
    #view-today,
    #view-forge,
    #view-library {
        display: none !important;
    }

    body {
        background: #fff;
        color: #111;
    }

    .card,
    .week,
    .day-det,
    .ex {
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        break-inside: avoid;
    }

    .today-name,
    .week-n,
    .block-name,
    .day-wd,
    .lib-name {
        color: #111 !important;
    }

    .kicker,
    .plan-meta,
    .week-note,
    .block-note,
    .ex-detail,
    .day-f,
    .vol-m {
        color: #444 !important;
    }

    .pill,
    .tag,
    .week-phase,
    .vol-n {
        background: #eee !important;
        color: #111 !important;
    }

    .week {
        page-break-inside: auto;
    }
}
