/* 색: 운동 그림 표본(docs/sample-figures.html)과 같은 값. 폰이 다크 모드면 어둡게 바뀐다 */
:root {
  --bg: #EEF1F4; --surface: #FFFFFF; --ink: #17212C; --muted: #586574; --line: #D5DBE2;
  --figure: #33414F; --figure2: #8693A0; --gear: #8E9BA8; --muscle: #D9412A; --muscle-soft: #F0A796;
  --accent: #B5321D; --accent-soft: rgba(217, 65, 42, .1); /* 글자용: 흰 바탕 대비 4.5 이상 */
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11171E; --surface: #1A232D; --ink: #E7ECF1; --muted: #9BA8B5; --line: #2D3844;
    --figure: #C4CED8; --figure2: #6B7884; --gear: #66747F; --muscle: #FF6B4F; --muscle-soft: #A5503F;
    --accent: #FF6B4F; --accent-soft: rgba(255, 107, 79, .14);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-tap-highlight-color: transparent;
  word-break: keep-all; /* 한글 단어 중간에서 줄바꿈하지 않기 */
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* 상단 바 */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.back[hidden] { display: none; }
.back { font-size: 32px; line-height: 1; width: 44px; height: 44px; display: grid; place-items: center; margin-left: -8px; }
.title { margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding: 16px; max-width: 640px; margin: 0 auto; }
.lead { color: var(--muted); margin: 0 0 16px; font-size: 15px; }

/* 운동 전에 읽기 */
.before {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-bottom: 14px; padding: 12px 14px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 14px;
}
.before b { color: var(--accent); }
.before span:not(.go) { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; }
.before .go { color: var(--accent); font-size: 22px; line-height: 1; }
.donts { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.donts li { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.donts small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

/* 첫 화면 칸 */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  min-height: 132px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile:active { transform: scale(.98); }
.tile.wide { grid-column: span 2; min-height: 100px; }
.tile .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 16px; }
.tile b { font-size: 17px; display: block; }
.tile small { color: var(--muted); font-size: 13px; }
.tile .soon { display: inline-block; white-space: nowrap; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 8px; margin-left: 6px; font-weight: 400; vertical-align: 2px; }

/* 부위 고르기 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  padding: 7px 14px; border-radius: 99px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chip .n { color: var(--muted); font-size: 13px; margin-left: 4px; }
.chip.on .n { color: var(--accent); }
.scroller { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller .chip { flex: none; }

.parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.part {
  padding: 18px 8px; text-align: center; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-weight: 600;
}
.part small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; margin-top: 2px; }

/* 운동 목록 */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.item svg { width: 64px; height: 61px; flex: none; border-radius: 10px; background: var(--bg); }
.item .txt { flex: 1; min-width: 0; }
.item b { display: block; font-size: 16px; }
.item small { color: var(--muted); font-size: 13px; }
.item .go { color: var(--muted); font-size: 22px; }
.lv { display: inline-flex; gap: 2px; vertical-align: 1px; margin-left: 2px; }
.lv i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.lv i.f { background: var(--accent); }
.count { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* 운동 상세 */
.stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.stage svg { display: block; width: 100%; height: auto; aspect-ratio: 200 / 190; }
.stage .view { position: absolute; left: 12px; top: 10px; font-size: 12px; color: var(--muted); }
.stage .play { position: absolute; right: 10px; top: 6px; min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 0 16px; font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); list-style: none; margin: 0 0 18px; padding: 0; }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 18px; height: 7px; border-radius: 4px; display: inline-block; }
.sw-m { background: var(--muscle); } .sw-s { background: var(--muscle-soft); } .sw-g { background: var(--gear); }
.meta { display: grid; gap: 10px; margin-bottom: 8px; }
.meta .row { display: flex; gap: 10px; align-items: baseline; }
.meta .k { width: 56px; flex: none; color: var(--muted); font-size: 14px; }
.meta .v { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { padding: 2px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.tag.main { border-color: var(--muscle); color: var(--accent); }
h2 { font-size: 17px; margin: 24px 0 10px; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; }
.steps li::before {
  content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); margin-top: 1px;
}
.tips { margin: 0; padding: 14px 16px 14px 34px; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); }
.tips li + li { margin-top: 6px; }
.en { color: var(--muted); font-size: 13px; margin: 2px 0 14px; }

.note { color: var(--muted); font-size: 13px; margin-top: 32px; line-height: 1.6; }
.note a { text-decoration: underline; display: inline-block; padding: 12px 0; }
.prep { text-align: center; padding: 48px 0; color: var(--muted); }

/* 운동 그림 (js/figure.js가 쓰는 이름) */
.f { stroke: var(--figure); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.f2 { stroke: var(--figure2); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fh { fill: var(--figure); stroke: none; }
.ft { fill: var(--figure); stroke: var(--figure); stroke-linejoin: round; }
.cut { stroke: var(--surface); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.item .cut { stroke: var(--bg); }
.m1 { stroke: var(--muscle); fill: none; stroke-linecap: round; }
.m2 { stroke: var(--muscle-soft); fill: none; stroke-linecap: round; }
.m1f { fill: var(--muscle); stroke: var(--muscle); stroke-linejoin: round; }
.m2f { fill: var(--muscle-soft); stroke: var(--muscle-soft); stroke-linejoin: round; }
.g { stroke: var(--gear); fill: none; stroke-linecap: round; stroke-linejoin: round; }
.gf { fill: var(--gear); stroke: none; }
.gl { fill: var(--line); stroke: none; }
.floor { stroke: var(--line); fill: none; stroke-linecap: round; }
