/* Colours come from themes.css (generated by tools/make_themes.py). */
:root { --radius: 12px; }

* { box-sizing: border-box; }
/* the hidden attribute always wins over display rules like .btn's */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75em; }
img { max-width: 100%; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.footer { color: var(--muted); font-size: .85rem; padding-bottom: 24px; }

/* ------------------------------------------------ top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.mainnav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a, .mainnav .linklike {
  color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem;
}
.mainnav a:hover, .mainnav .linklike:hover { background: var(--surface-2); }
.mainnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-sep { flex: 1; }
/* language switch: 🇬🇧 / 🇳🇴 — current one highlighted */
.lang-switch { display: inline-flex; align-items: center; gap: 2px; }
.mainnav a.flag, a.flag { padding: 5px; border-radius: 6px; opacity: .45; line-height: 0; transition: opacity .15s; }
a.flag:hover, a.flag:focus-visible { opacity: .9; background: var(--surface-2); }
a.flag.active { opacity: 1; background: var(--surface-2); }
a.flag img { height: 16px; width: auto; display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.lang-sep { color: var(--muted); font-size: .9rem; padding: 0 1px; }
.lang-switch.in-bar { display: none; }
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; margin-left: 8px; }
  .lang-switch.in-bar { display: inline-flex; margin-left: auto; }
  .lang-switch.in-nav { display: none; }
  .mainnav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding-bottom: 12px; }
  .mainnav.open { display: flex; }
  .mainnav .nav-sep { display: none; }
  .topbar .mainnav.open:not(#mainnav) { flex-direction: row; flex-basis: auto; padding: 0; margin-left: auto; flex: 0; }
}

/* section tabs under the top bar (Training, My Fitness) */
.subnav { background: var(--surface); border-bottom: 1px solid var(--border); }
.subnav-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav a { flex-shrink: 0; padding: 12px 14px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; border-bottom: 3px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------ building blocks */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow); display: block;
}
.card.narrow { max-width: 440px; margin: 24px auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; align-items: start; }
.grid-2 > .card, .grid-2 > .stack > .card { margin-bottom: 0; }
.grid-2 + * { margin-top: 20px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.wrap-row { flex-wrap: wrap; }
.grow { flex: 1 1 220px; }
.inline { display: inline; }
.nowrap { white-space: nowrap; }
.push-right { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); padding: 12px 0; }
.danger-text { color: var(--danger); cursor: pointer; }
.crumbs { margin: 0 0 4px; font-size: .9rem; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1, .page-head h2 { margin-bottom: .25em; }
.section-title { margin-top: 28px; color: var(--muted); font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; }
.toolbar { margin-bottom: 16px; align-items: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }

/* ------------------------------------------------ forms */
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 0; }
fieldset.row { align-items: center; }
legend { font-size: .9rem; font-weight: 500; padding: 0 4px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
input[type=file] { padding: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled { background: var(--surface-2); color: var(--muted); }
.row > label:not(.grow):not(.check) > input:not([type=file]) { width: auto; }
.w-num { width: 5.5em !important; }
.w-reps { width: 6.5em !important; }
.w-day { width: 8em !important; }
.w-date { width: 8.5em !important; }
.w-time { width: 5.5em !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1;
  padding: 0 16px; min-height: 40px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.btn.icon { min-height: 32px; width: 32px; padding: 0; }
.btn:disabled { opacity: .4; cursor: default; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
summary.btn { list-style: none; display: inline-flex; }
summary.btn::-webkit-details-marker { display: none; }
details > summary { cursor: pointer; margin: 8px 0; }
details[open] > form { margin-top: 10px; }
.inline-details { display: inline-block; vertical-align: middle; }
.inline-details[open] form { margin-top: 6px; }
.inline-details summary { margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-warn { background: var(--warn-soft); color: var(--warn); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash a { color: inherit; font-weight: 600; }

.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.tag-link { text-decoration: none; }
.tag-link:hover { color: var(--accent); background: var(--accent-soft); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }

/* ------------------------------------------------ tables */
.table-scroll { overflow-x: auto; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table.compact th, .table.compact td { padding: 5px 8px; }
.table td.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--surface-2); }
.plan-table input { min-height: 34px; padding: 4px 8px; }

/* ------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.card .stat { background: var(--surface-2); border: 0; }
a.stat-link { color: var(--text); text-decoration: none; }
a.stat-link:hover { border-color: var(--accent); }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-value small { font-size: .85rem; font-weight: 500; color: var(--muted); }
.stat-pill { background: var(--accent-soft); color: var(--accent); padding: 8px 14px; border-radius: 999px; white-space: nowrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

/* ------------------------------------------------ equipment picker */
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.eq-grid.compact { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-bottom: 8px; }
.eq-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 10px; cursor: pointer; font-weight: 600; transition: border-color .15s, background .15s;
}
.eq-card:hover { border-color: var(--muted); }
.eq-card input { position: absolute; opacity: 0; pointer-events: none; }
.eq-card-img { width: 100%; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.eq-card-img img { width: 100%; height: 100%; object-fit: contain; }
.eq-card-name { font-size: .88rem; line-height: 1.25; }
.eq-grid.compact .eq-card-name { font-size: .78rem; }
.eq-card-check {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: .8rem;
  background: var(--accent); color: var(--accent-ink); opacity: 0; transform: scale(.6); transition: .15s;
}
.eq-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.eq-card:has(input:checked) .eq-card-check { opacity: 1; transform: none; }
.eq-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.sticky-save { position: sticky; bottom: 0; padding: 12px 0; margin-top: 16px; background: linear-gradient(transparent, var(--bg) 35%); z-index: 5; }

.eq-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.eq-admin { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.eq-admin img { aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); border-radius: 8px; }
.eq-admin input, .eq-admin select { min-height: 34px; padding: 4px 8px; font-size: .88rem; }

/* ------------------------------------------------ exercises */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.ex-grid > .card { margin: 0; }
.ex-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.ex-card header { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ex-card h3 { margin: 0; flex-basis: 100%; }
.ex-card p { font-size: .9rem; color: var(--muted); margin: 0; flex: 1; }
.ex-card.unavailable { opacity: .7; }
.eq-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.eq-badge { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; background: var(--surface-2); border-radius: 999px; padding: 2px 10px 2px 2px; }
.eq-badge img { width: 28px; height: 28px; object-fit: contain; border-radius: 50%; background: var(--surface); }

.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; max-height: 480px; overflow-y: auto; padding: 2px; }
.pick { flex-direction: row; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-weight: 400; }
.pick[hidden] { display: none; }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pick.unavailable .pick-main strong { color: var(--muted); }
.pick-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-eq { display: flex; gap: 4px; flex-shrink: 0; }
.pick-eq img { width: 30px; height: 30px; object-fit: contain; background: var(--surface-2); border-radius: 6px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.plan-card { text-decoration: none; color: var(--text); margin: 0; transition: border-color .15s; }
.plan-card:hover { border-color: var(--accent); }

/* ------------------------------------------------ workout logging */
.ex-block { margin-bottom: 12px; }
.ex-block-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.ex-block-head h3 { margin: 0; }
.sets { counter-reset: set; display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.set-row { display: flex; align-items: flex-start; gap: 10px; counter-increment: set; padding: 8px 0; border-top: 1px solid var(--border); }
.set-row:first-child { border-top: 0; }
.set-row .set-no::before { content: counter(set); }
.set-no { width: 28px; height: 40px; margin-top: 22px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 8px; flex-shrink: 0; }
.set-row > .btn.icon { margin-top: 26px; flex-shrink: 0; }
.set-fields { display: flex; flex-wrap: wrap; gap: 10px 16px; flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 200px; max-width: 280px; }
.field label { font-size: .78rem; }
.field input { font-size: 1.15rem; font-weight: 600; text-align: center; }
.steps { display: flex; gap: 4px; }
.step {
  flex: 1; min-height: 40px; padding: 0 4px; border-radius: 8px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .9rem; color: var(--accent);
  background: var(--accent-soft); border: 1px solid transparent;
  touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.step:active { filter: brightness(.92); }
.step[data-step^="-"] { color: var(--muted); background: var(--surface-2); }

/* phones: one exercise per screen (app.js adds .paged) */
#log-form.paged .ex-block { display: none; }
#log-form.paged .ex-block.current { display: block; }
#log-form.paged:not(.on-finish) .log-extra { display: none; }
#log-form.paged.on-finish #blocks { display: none; }
#log-form.paged .sticky-save { position: static; background: none; }
.log-pager { position: sticky; bottom: 0; z-index: 6; display: flex; gap: 8px; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 30%); }
.log-pager[hidden] { display: none; }
.log-pager select { flex: 1; min-width: 0; }
.log-pager .btn { min-height: 44px; }

/* rest timer */
.block-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rest-btn { color: var(--accent); }
.rest-timer {
  position: fixed; z-index: 20; right: 16px; bottom: 16px; width: 340px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); display: flex; flex-direction: column; gap: 10px;
}
.rest-timer[hidden] { display: none; }
.rt-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rt-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-time { font-size: 3.2rem; font-weight: 800; text-align: center; line-height: 1; font-variant-numeric: tabular-nums; }
.rt-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.rt-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.rt-row { display: flex; gap: 6px; }
.rt-row > * { flex: 1; }
.rt-row .btn { padding: 0 8px; }
.rt-picker { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.rt-picker[hidden] { display: none; }
.rt-picker .chip { min-height: 40px; min-width: 56px; }
.rt-custom { display: flex; align-items: center; gap: 6px; }
.rt-custom .step { flex: 0 0 64px; }
.rt-custom-value { flex: 1; text-align: center; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rest-timer.done { border-color: var(--ok); }
body.timer-open main { padding-bottom: 300px; }
.rest-timer.done .rt-time, .rest-timer.done .rt-title { color: var(--ok); }
@media (max-width: 700px) {
  .rest-timer { left: 8px; right: 8px; bottom: 8px; width: auto; max-width: none; }
  #log-form.paged ~ .rest-timer { bottom: 72px; }
}

/* guided set-by-set mode (workouts from a plan) */
#log-form.guided .set-row:not(.current-set) { display: none; }
#log-form.guided .set-row { border-top: 0; padding-top: 0; }
#log-form.guided .set-no,
#log-form.guided .block-actions,
#log-form.guided [data-remove-block],
#log-form.guided [data-remove-set] { display: none; }
.g-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin: 0; }
.g-top select { flex: 1 1 200px; min-width: 0; }
.g-ctl { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.g-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 1.1rem; }
.g-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.g-dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); }
.g-dots span.done { background: var(--ok); border-color: var(--ok); }
.g-dots span.current { border-color: var(--accent); }
.g-big { min-height: 56px; font-size: 1.1rem; width: 100%; }
.g-links { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.g-links .linklike { color: var(--accent); font-weight: 600; padding: 10px 0; min-height: 44px; }
.rest-timer.inline { position: static; width: auto; max-width: none; box-shadow: none; z-index: auto; }

/* ------------------------------------------------ meals */
.meal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.meal { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.meal-photo { width: 84px; height: 84px; flex-shrink: 0; border-radius: 8px; object-fit: cover; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.6rem; }
.meal-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.meal-body strong { overflow-wrap: anywhere; }
.meal-macros { display: flex; gap: 6px; flex-wrap: wrap; }
.meal-actions { display: flex; gap: 6px; margin-top: 4px; }
.day-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.day-nav input { width: 8.5em; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: .85rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.field-label { font-size: .9rem; font-weight: 500; }
.photo-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-buttons label.btn { flex-direction: row; cursor: pointer; min-height: 48px; }
.photo-buttons label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (pointer: fine) { .camera-btn { display: none; } }
@media (pointer: coarse) { .photo-buttons label.btn { flex: 1 1 140px; } .camera-btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); } }
.photo-preview { max-width: 220px; border-radius: 8px; display: block; }
.photo-preview[hidden] { display: none; }

/* ------------------------------------------------ rankings */
.tabs { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; }
.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.tabs a.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.optin { border-color: var(--accent); }
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.board li:last-child { border-bottom: 0; }
.board li.me { background: var(--accent-soft); border-radius: 8px; }
.board-rank { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.podium.p1 .board-rank { background: #f5c542; color: #3d2e00; }
.podium.p2 .board-rank { background: #c8cdd5; color: #2b3038; }
.podium.p3 .board-rank { background: #d99a62; color: #3a1f08; }
.board-name { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-wrap: anywhere; }
.board-score { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.board-gap { justify-content: center; color: var(--muted); border-bottom: 0 !important; padding: 2px !important; }

/* ------------------------------------------------ picture viewer */
main img { cursor: zoom-in; }
main label img, main button img { cursor: inherit; }
html.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, .85); cursor: zoom-out; animation: lb-in .15s ease-out;
}
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }
.lb-frame { position: relative; margin: 0; display: flex; flex-direction: column; align-items: center; max-width: 100%; max-height: 100%; }
.lb-frame img { display: block; max-width: min(94vw, 1400px); max-height: 85vh; object-fit: contain; border-radius: 10px; cursor: default; background: var(--surface); }
.lb-frame img.lb-drawing { width: min(90vw, 640px); height: auto; padding: 16px; }
.lb-close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(0, 0, 0, .65); color: #fff; font-size: 1.25rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-close:hover, .lb-close:focus-visible { background: rgba(0, 0, 0, .85); outline: 2px solid #fff; }
.lb-frame figcaption { color: #eee; margin-top: 10px; text-align: center; cursor: default; }

/* exercise guide: page, and the ⓘ pop-up sheet */
.guide-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 20px; align-items: start; }
.guide-layout > .card, .guide-layout > .stack > .card { margin: 0; }
@media (max-width: 800px) { .guide-layout { grid-template-columns: 1fr; } }
.guide h3 { margin-top: 20px; }
.guide-intro { font-size: 1.05rem; }
.guide-steps { padding-left: 1.4em; }
.guide-steps li, .guide-tips li { margin-bottom: 8px; }
.guide-tips { padding-left: 1.2em; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; margin-bottom: 12px; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-btn { background: #e62117; border-color: #e62117; color: #fff; min-height: 48px; margin-bottom: 8px; }
.video-btn:hover { background: #c81a12; }
.guide-btn { min-height: 28px; width: 28px; font-size: .95rem; color: var(--accent); vertical-align: middle; margin-left: 4px; }
.ex-card h3 a { color: var(--text); text-decoration: none; }
.ex-card h3 a:hover { color: var(--accent); }
.lb-sheet {
  position: relative; width: min(680px, 100%); max-height: 88vh; overflow-y: auto; cursor: default;
  background: var(--surface); color: var(--text); border-radius: 14px; padding: 20px;
}
.lb-sheet .lb-close { position: sticky; top: 0; float: right; margin: -8px -8px 0 8px; }
.sheet-title { margin-bottom: 2px; padding-right: 40px; }

/* ------------------------------------------------ blog & personal log */
.post-list { display: flex; flex-direction: column; gap: 20px; max-width: 760px; }
.post-list .card { margin: 0; }
.post-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.post-subject { font-size: 1.35rem; margin-bottom: 4px; overflow-wrap: anywhere; }
.post-body { line-height: 1.65; overflow-wrap: anywhere; }
.post-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.post-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: block; }
.post-photos.single { grid-template-columns: 1fr; }
.post-photos.single img { aspect-ratio: auto; max-height: 520px; object-fit: contain; }
.post-photos.edit { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.photo-keep { display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
.photo-keep .check { display: flex; gap: 6px; align-items: center; font-size: .85rem; }
.post-tags { margin-top: 12px; }
.post-mod { margin: -12px 0 0; text-align: right; }
.hashtag { text-decoration: none; font-weight: 600; }
.tag-cloud { margin-bottom: 20px; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.active .muted { color: inherit; opacity: .8; }
a.chip { text-decoration: none; }
.photo-previews { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-preview-item { position: relative; width: 96px; height: 96px; }
.photo-preview-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-preview-item .lb-close { top: 4px; right: 4px; width: 28px; height: 28px; font-size: .85rem; }
.publish-check { align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.publish-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.publish-check input { margin-top: 4px; }
.empty-state { text-align: center; padding: 32px 20px; max-width: 760px; }

/* ------------------------------------------------ charts */
.chart { width: 100%; height: 280px; margin: 8px 0 16px; }
.chart-short { height: 200px; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; }
.chart .goal { stroke: var(--ok); stroke-dasharray: 5 4; stroke-width: 1.5; }
.chart .goal-label { fill: var(--ok); font-size: 11px; }
.chart .legend { fill: var(--text); font-size: 12px; }
.chart .tip { pointer-events: none; }
.chart .tip rect { fill: var(--surface); stroke: var(--border); }
.chart .tip text { fill: var(--text); font-size: 12px; }

/* ------------------------------------------------ landing */
.hero { text-align: center; padding: 48px 0 32px; max-width: 640px; margin: 0 auto; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.hero p { font-size: 1.15rem; color: var(--muted); }
.hero .row { justify-content: center; margin-top: 20px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature-grid .card { margin: 0; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .card { padding: 16px; }
  .field { max-width: none; flex-basis: 100%; }
}

/* ------------------------------------------------ workouts grouped by day / week / month */
.view-switch { margin-bottom: 16px; }
.groups { display: flex; flex-direction: column; gap: 12px; }
.groups .card { margin: 0; padding: 0; overflow: hidden; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; padding: 14px 18px; cursor: pointer; list-style: none; margin: 0; }
.group-head::-webkit-details-marker { display: none; }
.group-head::before { content: '▸'; color: var(--muted); margin-right: 6px; transition: transform .15s; display: inline-block; }
details[open] > .group-head::before { transform: rotate(90deg); }
.group-title { flex: 1 1 auto; }
.group .table-scroll { margin: 0; border-top: 1px solid var(--border); }
.group .table td { border-bottom-color: var(--border); }
.group .table tr:last-child td { border-bottom: 0; }
.group .table td:first-child { padding-left: 18px; }

/* ------------------------------------------------ calendar */
.week-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.week-day { padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.week-day:has(select option:checked:not([value=""])) { border-color: var(--accent); background: var(--accent-soft); }
.week-day select { margin-top: 4px; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; min-width: 9em; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 20px; }
.cal-wd { font-size: .8rem; font-weight: 600; color: var(--muted); text-transform: uppercase; text-align: center; padding: 4px 0; }
.cal-day { min-height: 96px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.other { opacity: .45; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-num { font-size: .8rem; font-weight: 700; color: var(--muted); padding: 0 2px; }
.cal-day.today .cal-num { color: var(--accent); }
.cal-entry { display: flex; align-items: center; gap: 2px; border-radius: 6px; font-size: .78rem; line-height: 1.25; background: var(--accent-soft); }
.cal-entry a { flex: 1; min-width: 0; padding: 3px 5px; color: var(--accent); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-entry.done { background: var(--ok-soft); } .cal-entry.done a { color: var(--ok); }
.cal-entry.missed { background: var(--surface-2); } .cal-entry.missed a { color: var(--muted); text-decoration: line-through; }
.cal-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .7rem; padding: 2px 4px; }
.cal-x:hover { color: var(--danger); }
.cal-agenda { display: none; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.agenda-day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.agenda-day.today { border-color: var(--accent); }
.agenda-date { margin-bottom: 6px; }
.agenda-entry { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); }
.agenda-entry.missed .agenda-title { color: var(--muted); }
.status-done { background: var(--ok-soft); color: var(--ok); }
.status-today { background: var(--accent-soft); color: var(--accent); }
.status-missed { background: var(--surface-2); color: var(--muted); }
.cal-below { margin-top: 8px; }
@media (max-width: 700px) {
  .cal-grid { display: none; }
  .cal-agenda { display: flex; }
}

.planner { margin-bottom: 20px; }
.planner-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; list-style: none; cursor: pointer; margin: 0; }
.planner-head::-webkit-details-marker { display: none; }
.planner[open] .planner-head { margin-bottom: 16px; }
.week-day select { width: 100%; }

/* dashboard: next planned session (top of the page; Start on the right for thumbs) */
.next-session { border-color: var(--accent); }
.next-row { display: flex; align-items: center; gap: 16px; }
.next-info { flex: 1; min-width: 0; }
.next-label { margin: 0 0 2px; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.next-when { color: var(--accent); }
.next-title { margin: 0 0 2px; font-size: 1.3rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.next-start { flex-shrink: 0; min-height: 56px; min-width: 112px; padding: 0 22px; font-size: 1.1rem; border-radius: 14px; }
.next-after { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 560px) { .next-start { min-width: 96px; padding: 0 16px; } .next-title { font-size: 1.15rem; } }
/* colour scheme picker (profile) */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.swatch { flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 2px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 500; text-align: center; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch-dot { width: 36px; height: 36px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.swatch-name { font-size: .85rem; }
.swatch:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
