/* Target82: gym-log look. Plate-dark surfaces, the orange of the weight-stack pin as the accent. */
:root {
  --bg: #eef1f4; --surface: #ffffff; --ink: #17212b; --muted: #5a6776; --line: #d8dee5;
  --plate: #1e2833; --plate-ink: #f2f5f8; --pin: #e8820f; --pin-soft: #fbe6cc; --pin-ink: #2a1600;
  --good: #1f7a4d; --bad: #b3261e; --good-soft: #dff1e7; --bad-soft: #f8dcda;
  --font: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151b; --surface: #17202a; --ink: #e7ecf1; --muted: #9aa7b5; --line: #2a3541;
    --plate: #2a3642; --plate-ink: #f2f5f8; --pin: #f39a37; --pin-soft: #3a2a17; --pin-ink: #1d1000;
    --good: #5fc792; --bad: #ff8a80; --good-soft: #1d3327; --bad-soft: #3a1d1b;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding: env(safe-area-inset-top, 0px) max(14px, env(safe-area-inset-right, 0px)) calc(72px + env(safe-area-inset-bottom, 0px)) max(14px, env(safe-area-inset-left, 0px));
}
header.top { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 0 8px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.brand img { border-radius: 6px; }
button { font: inherit; cursor: pointer; }
button.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; }
button.primary { background: var(--plate); color: var(--plate-ink); border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 600; }
button.primary:disabled { opacity: .5; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--pin); outline-offset: 2px; }
main { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; }
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--plate); padding-bottom: env(safe-area-inset-bottom, 0px);
}
nav.tabs a { color: var(--plate-ink); text-decoration: none; text-align: center; padding: 14px 0; font-weight: 600; opacity: .7; }
nav.tabs a[aria-current="page"] { opacity: 1; box-shadow: inset 0 3px 0 var(--pin); }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--plate); color: var(--plate-ink); border-color: var(--plate); }
.chip small { display: block; font-weight: 500; font-size: .7rem; opacity: .75; }
h2 { margin: 4px 0 0; font-size: 1.4rem; }
.meta { color: var(--muted); font-size: .9rem; }
.notice { background: var(--pin-soft); border-radius: 8px; padding: 10px 12px; font-size: .93rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.num { color: var(--pin); font-weight: 700; font-size: .85rem; }
.card h3 { margin: 0; font-size: 1.15rem; line-height: 1.2; }
.sets { font-weight: 600; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--pin); color: var(--pin-ink); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; }
.plate { flex: 0 0 auto; background: var(--plate); color: var(--plate-ink); border-radius: 8px; padding: 6px 10px; min-width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.plate .k { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.plate .v { font-weight: 700; font-size: 1.25rem; line-height: 1.1; }
.plate .u { font-size: .65rem; opacity: .7; }
.note { color: var(--muted); font-size: .92rem; margin: 0; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
ul.cues { margin: 0; padding-left: 20px; display: grid; gap: 2px; font-size: .95rem; }
.link { color: var(--pin); font-weight: 600; text-decoration: none; font-size: .9rem; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.tile .k { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.tile .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { color: var(--muted); font-size: .85rem; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--pin); }
.bar i.ok { background: var(--good); }
table.list { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.list td { border-top: 1px solid var(--line); padding: 7px 4px; vertical-align: top; }
table.list td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph { position: relative; border-radius: 8px; overflow: hidden; background: var(--line); aspect-ratio: 1; border: 3px solid transparent; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.ph .t { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; border-radius: 4px; padding: 0 4px; }
.ph .vid { position: absolute; right: 4px; top: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; border-radius: 4px; padding: 0 4px; }
.ph.move { border-color: var(--good); }
.ph.move::after { content: "→ Target82"; position: absolute; inset: auto 0 0 0; background: var(--good); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; }
.ph.del { border-color: var(--bad); opacity: .75; }
.ph.del::after { content: "Delete"; position: absolute; inset: auto 0 0 0; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; text-align: center; }
.actionbar { position: sticky; bottom: calc(56px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 8px; background: var(--bg); padding: 8px 0; }
.actionbar button { flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(8,12,16,.9); display: grid; place-items: center; padding: 16px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; }
.lightbox button { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; background: #fff; color: #111; border: 0; border-radius: 999px; padding: 8px 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(70px + env(safe-area-inset-bottom, 0px)); background: var(--plate); color: var(--plate-ink); padding: 10px 14px; border-radius: 10px; z-index: 30; max-width: 90vw; }
.toast[hidden] { display: none; }
.score { display: inline-block; font-weight: 700; font-size: .78rem; border-radius: 4px; padding: 0 5px; }
.score.good { background: var(--good-soft); color: var(--good); }
.score.mid { background: var(--pin-soft); color: var(--ink); }
.score.low { background: var(--bad-soft); color: var(--bad); }
.watch { color: var(--bad); font-size: .82rem; }
