/* Lift Log — dark, high-contrast, thumb-friendly. Yellow = the cells you fill in. */

:root {
  --bg: #121316;
  --surface: #1c1e22;
  --surface-2: #26292e;
  --control: #2c2f35;
  --line: #33373d;
  --text: #f2f1ec;
  --muted: #9ba0a8;
  --faint: #6b7078;
  --accent: #f5c518;
  --accent-hover: #ffd84d;
  --on-accent: #121316;
  --danger: #ff8a7a;
  --radius: 14px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
html.is-resting { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Barlow, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 24px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* type */
.display { font-family: var(--display); font-size: 44px; line-height: 1; font-weight: 700; }
.title { font-family: var(--display); font-size: 32px; line-height: 1.05; font-weight: 700; }
.eyebrow { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* layout helpers */
.stack { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.stack-xs { display: flex; flex-direction: column; gap: 3px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.flash { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.flash--alert { color: var(--danger); border: 1px solid currentColor; background: transparent; }

.card { padding: 12px 14px; background: var(--surface); border-radius: 12px; }
.card--accent { border: 2px solid var(--accent); }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; font-weight: 500; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 15px; font-weight: 600;
}

/* buttons */
.btn {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 0 16px; border: none; border-radius: var(--radius);
  font-size: 17px; font-weight: 600;
}
.btn--primary { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 18px; min-height: 58px; }
.btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn--secondary { background: var(--control); color: var(--text); }
.btn--ghost { background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 18px; }
.btn--small { min-height: 44px; padding: 0 14px; border-radius: 10px; font-size: 15px; background: var(--surface); border: 1px solid var(--line); color: var(--text); flex-shrink: 0; }
.btn--dark { background: var(--bg); color: var(--accent); font-weight: 700; font-size: 21px; min-height: 64px; }
.btn--outline-dark { background: transparent; border: 2px solid var(--bg); color: var(--bg); font-weight: 700; }
.btn--log { flex-direction: column; gap: 0; }
.btn[disabled], .btn[aria-busy="true"] { opacity: 0.6; }

.bottom-action { margin-top: auto; position: sticky; bottom: calc(env(safe-area-inset-bottom) + 12px); }

/* week screen */
.files { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 14px; }
.files div { display: flex; justify-content: space-between; gap: 12px; }
.files dt { color: var(--muted); flex-shrink: 0; }
.files dd { margin: 0; font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.day-card {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.day-card:hover { color: var(--text); background: var(--surface-2); }
.day-card.is-next { outline: 2px solid var(--accent); outline-offset: -2px; }
.day-card__body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.day-card__title { display: flex; align-items: center; gap: 10px; }
.day-card__name { font-family: var(--display); font-size: 26px; font-weight: 700; }
.day-card__count { display: flex; flex-direction: column; align-items: flex-end; min-width: 56px; }
.day-card__count strong { font-family: var(--display); font-size: 22px; font-weight: 600; }

.badge { background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.06em; }
.badge--muted { background: var(--control); color: var(--text); }

.bar { height: 4px; background: var(--control); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.bar span.is-done { background: var(--muted); }

/* day screen */
.exercise-row {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.exercise-row:hover { color: var(--text); background: var(--surface-2); }
.exercise-row.is-current { background: var(--surface-2); outline: 2px solid var(--accent); outline-offset: -2px; }
.exercise-row__body { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.exercise-row__name { font-size: 17px; font-weight: 600; }
.chevron { color: var(--muted); flex-shrink: 0; }
.dots { display: flex; gap: 6px; }
.dots span { width: 22px; height: 6px; border-radius: 3px; background: var(--line); }
.dots span.is-done { background: var(--accent); }
.dots span.is-now { background: var(--text); }

/* exercise screen */
.exercise-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.note { padding: 10px 12px; background: var(--surface); border-radius: 10px; font-size: 14px; overflow-wrap: anywhere; }

.sets { display: flex; flex-direction: column; gap: 2px; }
.sets__row {
  display: grid; grid-template-columns: 40px repeat(3, minmax(0, 1fr)); gap: 8px; align-items: center;
  padding: 10px; border-radius: 10px; color: var(--text); font-size: 16px; font-weight: 500; min-height: 44px;
}
a.sets__row:hover { color: var(--text); background: var(--surface); }
.sets__row.is-current, a.sets__row.is-current:hover { background: var(--surface-2); }
.sets__head { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-bottom: 4px; min-height: 0; }
.set-num {
  width: 28px; height: 28px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; background: var(--surface-2); color: var(--muted);
}
.set-num.is-done { background: var(--accent); color: var(--on-accent); }
.set-num.is-current { background: transparent; border: 2px solid var(--accent); color: var(--accent); }
.today { color: var(--faint); }
.today.is-done { color: var(--text); font-weight: 700; }
.today.is-current { color: var(--accent); font-weight: 700; }

.entry {
  margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px;
  background: var(--surface); border-radius: 16px;
}
.entry__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.entry__title { font-family: var(--display); font-size: 22px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; text-align: center; }
.field input {
  width: 100%; height: 56px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
  text-align: center; font-family: var(--display); font-size: 34px; font-weight: 600;
}
.step { height: 44px; border: none; border-radius: 10px; background: var(--control); font-size: 22px; font-weight: 600; }
.step:active { background: var(--line); }
.comment { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 16px; }

/* swap sheet */
.sheet {
  margin: auto auto 0; width: 100%; max-width: 480px; border: none; padding: 12px 20px calc(env(safe-area-inset-bottom) + 24px);
  border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
}
.sheet[open] { display: flex; flex-direction: column; gap: 10px; }
.sheet::backdrop { background: rgb(0 0 0 / 0.6); }
.sheet__grip { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet__title { font-family: var(--display); font-size: 28px; font-weight: 700; margin-top: 4px; }
.option-form { margin: 0; }
.option {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px;
  padding: 8px 14px; border-radius: 12px; text-align: left; border: 1px solid var(--line); background: transparent;
}
.option.is-selected { border: 2px solid var(--accent); background: var(--surface-2); }
.option__name { font-size: 17px; font-weight: 600; }
.radio { width: 20px; height: 20px; border-radius: 10px; border: 2px solid var(--faint); flex-shrink: 0; }
.option.is-selected .radio { border: 6px solid var(--accent); }

/* rest timer overlay */
.rest { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; }
.rest[hidden], .rest [hidden] { display: none !important; }
.rest__running, .rest__alert {
  max-width: 480px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 20px);
}
.rest__top { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.rest__skip { margin-top: auto; }
.up-next__name { font-size: 18px; font-weight: 600; }

.ring { position: relative; width: min(260px, 70vw); aspect-ratio: 1; align-self: center; }
.ring svg { width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 12; }
.ring__track { stroke: var(--surface-2); }
.ring__bar { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 754; transition: stroke-dashoffset 0.25s linear; }
.ring__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__time { font-family: var(--display); font-size: 84px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }

.chip { height: 44px; border-radius: 10px; font-size: 16px; font-weight: 600; border: 1px solid var(--line); background: transparent; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }

.rest__alert { background: var(--accent); color: var(--on-accent); animation: flash 0.5s ease-in-out 4 alternate; }
.rest:has(.rest__alert:not([hidden])) { background: var(--accent); }
.rest__alert-title { font-family: var(--display); font-size: 76px; line-height: 0.95; font-weight: 700; }
.rest__alert-sub { font-size: 22px; font-weight: 600; }
.rest__alert-card { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: rgb(18 19 22 / 0.08); border-radius: var(--radius); font-size: 17px; }
.rest__go { margin-top: auto; }

@keyframes flash {
  from { background: var(--accent); }
  to { background: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  .rest__alert { animation: none; }
  .ring__bar { transition: none; }
}

/* login */
.login-head { margin-top: 12vh; }
.login { margin-top: 0; }
.field--wide input { font-family: inherit; font-size: 24px; letter-spacing: 0.04em; }
.field--wide label { text-align: left; }
.week-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.week-head form { margin: 0; }

/* upload */
.field--wide input.file-input { height: auto; padding: 14px 12px; font-size: 16px; text-align: left; letter-spacing: 0; }
.file-input::file-selector-button {
  margin-right: 12px; padding: 8px 14px; border: none; border-radius: 8px;
  background: var(--control); color: var(--text); font: inherit; font-weight: 600;
}

/* bottom tabs */
body.has-tabs .screen { padding-bottom: calc(env(safe-area-inset-bottom) + 88px); }
body.has-tabs .bottom-action { bottom: calc(env(safe-area-inset-bottom) + 76px); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px max(8px, calc((100vw - 480px) / 2)) calc(env(safe-area-inset-bottom) + 6px);
  background: rgb(18 19 22 / 0.94); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; color: var(--muted); font-size: 12px; font-weight: 600;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); }

/* weight & cardio */
.entry--inline { margin-top: 0; }
.grid-2--roomy { gap: 10px; }
.field--wide input[type="date"] { font-size: 20px; text-align: left; padding: 0 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat__label { font-size: 13px; color: var(--muted); }
.stat__value { font-size: 32px; font-weight: 600; line-height: 1.1; }
.stat__value small { font-size: 15px; color: var(--muted); font-weight: 500; }
.stat__delta { font-size: 13px; color: var(--muted); }
.stat--small { padding: 8px 12px; align-items: flex-end; }
.stat--small .stat__value { font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip--sm { height: 36px; padding: 0 12px; font-size: 14px; }
.list--tight { gap: 2px; }
.log-row {
  display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 8px; align-items: center;
  min-height: 44px; padding: 8px 10px; border-radius: 10px; color: var(--text); font-size: 15px;
}
.log-row:hover, .log-row.is-current { color: var(--text); background: var(--surface); }
.log-row span:last-child { text-align: right; }

/* insights */
:root { --chart: #b98a00; --chart-context: #6b7078; --grid: #2c2f35; }
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface); border-radius: 12px; }
.segmented__item { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 9px; color: var(--muted); font-weight: 600; }
.segmented__item:hover { color: var(--text); }
.segmented__item.is-active { background: var(--surface-2); color: var(--text); }
.insight { display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; }
.insight__head { display: flex; flex-direction: column; gap: 2px; }
.insight__title { font-size: 15px; font-weight: 600; color: var(--muted); }
.insight__figure { font-size: 40px; font-weight: 600; line-height: 1.1; }
.insight__figure small { font-size: 16px; color: var(--muted); font-weight: 500; }

.chart { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-key--line { width: 16px; height: 2px; border-radius: 1px; background: var(--chart); }
.legend-key--dot { width: 6px; height: 6px; border-radius: 3px; background: var(--chart-context); }
.chart__plot { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.chart__grid { stroke: var(--grid); stroke-width: 1; }
.chart__baseline { stroke: var(--chart-context); stroke-width: 1; }
.chart__tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__dot { fill: var(--chart-context); opacity: 0.7; }
.chart__marker { fill: var(--chart); stroke: var(--surface); stroke-width: 2; }
.chart__end-label { fill: var(--text); font-size: 12px; font-weight: 600; }
.chart__crosshair { stroke: var(--muted); stroke-width: 1; }
.chart__column path { fill: var(--chart); }
.chart__column.is-partial path { fill: var(--chart); opacity: 0.55; }
.chart__column.is-hover path { fill: #d19c00; opacity: 1; }
.chart__tooltip {
  position: absolute; top: -8px; transform: translateY(-100%); pointer-events: none; z-index: 2;
  min-width: 120px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
  border: 1px solid var(--line); box-shadow: 0 6px 20px rgb(0 0 0 / 0.4); font-size: 13px;
}
.chart__tooltip-title { color: var(--muted); margin-bottom: 4px; }
.chart__tooltip-row { display: flex; gap: 8px; align-items: baseline; }
.chart__tooltip-row strong { font-size: 15px; }
.chart__tooltip-row span { color: var(--muted); }

.chart-table summary, .explain summary { cursor: pointer; color: var(--muted); font-size: 14px; min-height: 32px; display: flex; align-items: center; }
.explain p { margin: 6px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 4px; }
.data-table td { padding: 7px 4px; border-top: 1px solid var(--grid); }
.data-table .num, .data-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.chart-table { max-height: none; }
.chart-table[open] .data-table { margin-top: 4px; }
.field--wide input[type="text"] { font-family: inherit; font-size: 18px; font-weight: 500; text-align: left; padding: 0 12px; letter-spacing: 0; }

/* settings */
.source { display: flex; flex-direction: column; gap: 12px; padding: 16px 14px; }
.source.is-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.source__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.source__title { font-size: 20px; font-weight: 700; }
.source-link { font-weight: 600; }
.option-form .btn { width: 100%; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* background save status */
.sync-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--danger); background: rgb(255 138 122 / 0.08);
}
.sync-banner strong { font-size: 15px; }

/* inside the iOS app: native navigation bar and tabs replace these */
html[data-native] .back { visibility: hidden; }
html[data-native] .native-hidden { display: none !important; }

/* privacy and terms */
.legal { display: flex; flex-direction: column; gap: 12px; line-height: 1.5; }
.legal h2 { font-family: var(--display); font-size: 22px; margin-top: 12px; }
.legal ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
