/* 디자인: 캔버스 "셋째 방향 단계 길형" + 글씨체 프리텐다드(2026-11-21 사용자 확정)
   https://claude.ai/artifact/3VBnsWsDBQVXfb1dhegUYg  보드 PathPretendard, PathMore
   밝은 화면만(다크 모드는 첫 판에서 뺌, 사용자 결정). 강조색 파랑 #3268f0. */
@font-face { font-family: 'Pretendard'; font-weight: 400; font-display: swap; src: url(../fonts/Pretendard-Regular.subset.woff2) format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 500; font-display: swap; src: url(../fonts/Pretendard-Medium.subset.woff2) format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 700; font-display: swap; src: url(../fonts/Pretendard-Bold.subset.woff2) format('woff2'); }
@font-face { font-family: 'Pretendard'; font-weight: 800; font-display: swap; src: url(../fonts/Pretendard-ExtraBold.subset.woff2) format('woff2'); }

:root {
  --bg: #ffffff;
  --soft: #f4f7fd;
  --text: #191f28;
  --text2: #333d4b;
  --sub: #6b7684;
  --sub2: #8b95a1;
  --faint: #c5ccd6;
  --line: #f2f4f6;
  --line2: #eef0f3;
  --track: #d9e0ea;
  --ring: #eef1f6;
  --accent: #3268f0;
  --accent-soft: #e8efff;
  --accent-dark: #1d4ed8;
  --btn: #f2f4f6;
  --danger: #e5503f;
  --outside: #e9edf2;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--outside);
  color: var(--text);
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px rgba(20,30,50,0.04), 0 2px 16px rgba(20,30,50,0.06); }
}

.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }
.safe-top { padding-top: max(20px, env(safe-area-inset-top)); }

/* 아래 탭 */
.nav {
  flex: none;
  height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid var(--line2);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--bg);
}
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; color: var(--sub2); }
.nav button[aria-current="page"] { color: var(--text); font-weight: 700; }
.nav svg { width: 24px; height: 24px; }

/* 홈 */
.hero { background: var(--soft); padding: 44px 24px 26px; display: flex; flex-direction: column; gap: 22px; }
.hero-top { display: flex; flex-direction: column; gap: 4px; }
.label { font-size: 14px; color: var(--sub); }
.big { font-size: 64px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.big small { font-size: 18px; font-weight: 800; letter-spacing: 0; margin-left: 6px; }
.big.q { font-size: 40px; line-height: 1.15; }
.accent { color: var(--accent); }
.hero .remain { font-size: 15px; font-weight: 800; color: var(--accent); }

.path { position: relative; height: 54px; margin: 0 8px; }
.path .track, .path .fill { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 2px; }
.path .track { right: 0; background: var(--track); }
.path .fill { background: var(--accent); }
.path .mark { position: absolute; top: 0; width: 40px; margin-left: -20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.path .dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 7px; background: var(--track); }
.path .mark.on .dot { background: var(--accent); }
.path .mark span { font-size: 14px; font-weight: 800; color: var(--sub2); }
.path .mark.on span { color: var(--accent); }
.path .mark.now span { color: var(--text); }
.path .now-ring { position: absolute; top: 0; width: 22px; height: 22px; margin-left: -11px; border-radius: 11px; background: #fff; border: 5px solid var(--accent); }
.path .mark.now .dot { display: none; }
.path .mark.now { gap: 4px; }
.path .mark.now::before { content: ''; width: 22px; height: 22px; border-radius: 11px; background: #fff; border: 5px solid var(--accent); box-sizing: border-box; }

.today { padding: 24px 24px 8px; display: flex; flex-direction: column; gap: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.h3 { font-size: 19px; font-weight: 800; }
.stage-chip { font-size: 13px; font-weight: 700; color: var(--accent); }
.sets { display: flex; flex-direction: column; }
.sets .set { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.sets .set:last-child { border-bottom: 0; }
.sets .set > span:first-child { color: var(--sub); }
.sets .set b { font-size: 17px; font-weight: 800; }
.sets .set .more { color: var(--accent); font-weight: 700; }
.sets .set .more b { color: var(--accent); }
.note { font-size: 14px; color: var(--sub); }
.note.blue { color: var(--accent); font-weight: 700; }
.home-actions { padding: 12px 24px 12px; display: flex; flex-direction: column; gap: 4px; }
.btn { width: 100%; height: 58px; border-radius: 16px; background: var(--accent); color: #fff; font-size: 18px; font-weight: 800; }
.btn:active { filter: brightness(0.94); }
.btn.gray { background: var(--btn); color: var(--text2); font-weight: 700; font-size: 16px; }
.btn.white { background: #fff; color: var(--accent-dark); font-size: 17px; }
.btn.small { height: 56px; font-size: 16px; font-weight: 700; }
.link { height: 44px; font-size: 14px; font-weight: 700; color: var(--sub); }
.test-card { background: var(--soft); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.test-card b { font-size: 17px; }

/* 운동 중 */
.run { flex: 1; display: flex; flex-direction: column; background: var(--bg); }
.run-head { padding: max(16px, env(safe-area-inset-top)) 20px 0; height: calc(60px + env(safe-area-inset-top)); display: flex; align-items: center; justify-content: space-between; }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--sub); border-radius: 22px; }
.icon-btn svg { width: 24px; height: 24px; }
.run-title { font-size: 16px; font-weight: 700; }
.run-title .of { color: var(--sub2); font-weight: 500; }
.run-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 0 24px; }
.ring { position: relative; width: min(300px, 78vw); aspect-ratio: 1; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring .bar { transition: stroke-dashoffset 0.35s ease; }
.ring-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.ring-num { font-size: min(140px, 36vw); font-weight: 800; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.ring-label { font-size: 17px; font-weight: 700; color: var(--sub); text-align: center; }
.phase { height: 22px; font-size: 16px; font-weight: 700; color: var(--accent); }
.run-foot { padding: 0 24px calc(28px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.run-foot.one { grid-template-columns: 1fr; }
.run.paused .ring-num { color: var(--faint); }

/* 휴식 */
.rest { flex: 1; display: flex; flex-direction: column; background: var(--accent); color: #fff; }
.rest .run-head .icon-btn { color: #dbe6ff; }
.rest-body { flex: 1; padding: 0 28px; display: flex; flex-direction: column; justify-content: center; gap: 28px; }
.rest-done { font-size: 22px; font-weight: 800; }
.rest-time { font-size: 112px; font-weight: 800; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.rest-prog { display: flex; flex-direction: column; gap: 10px; }
.rest-prog .row-between { font-size: 15px; }
.rest-prog .row-between b { font-weight: 700; }
.rest-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.28); overflow: hidden; }
.rest-bar div { height: 8px; background: #fff; }
.rest-next { font-size: 17px; font-weight: 700; }
.rest-foot { padding: 0 24px calc(28px + env(safe-area-inset-bottom)); }

/* 실력 재기 */
.test-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.test-num { font-size: min(170px, 44vw); font-weight: 800; line-height: 1; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
.test-foot { padding: 0 24px calc(28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }

/* 결과 */
.page { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 18px; }
.page-head { padding: max(20px, env(safe-area-inset-top)) 24px 0; }
.title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 0; }
.result-total { font-size: 15px; color: var(--sub); }
.result-total b { color: var(--text); font-size: 17px; }
.edit-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.edit-row:last-child { border-bottom: 0; }
.edit-row .l { display: flex; flex-direction: column; gap: 2px; }
.edit-row .l span:first-child { font-size: 15px; font-weight: 700; }
.edit-row .l span:last-child:not(:first-child) { font-size: 13px; color: var(--sub); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 40px; height: 40px; border-radius: 12px; background: var(--btn); color: var(--text2); font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.stepper input { width: 56px; height: 40px; border: 0; border-radius: 12px; background: var(--soft); text-align: center; font-size: 18px; font-weight: 800; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper.big-step { justify-content: center; }
.stepper.big-step input { width: 96px; height: 64px; font-size: 36px; border-radius: 16px; }
.stepper.big-step button { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }
.msg { background: var(--soft); border-radius: 16px; padding: 16px 18px; font-size: 15px; display: flex; flex-direction: column; gap: 4px; }
.msg b { font-size: 16px; }
.foot { padding: 12px 24px calc(16px + env(safe-area-inset-bottom)); flex: none; }

/* 기록 */
.rec-top { padding: 44px 24px 0; display: flex; flex-direction: column; gap: 4px; }
.rec-best { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.rec-best small { font-size: 17px; margin-left: 4px; }
.rec-best em { font-style: normal; font-size: 15px; font-weight: 700; color: var(--accent); margin-left: 10px; letter-spacing: 0; }
.chart { padding: 18px 24px 8px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.stats { margin: 8px 24px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--soft); border-radius: 16px; padding: 14px 6px; }
.stats div { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stats b { font-size: 18px; font-weight: 800; }
.stats span { font-size: 12px; color: var(--sub); }
.list { padding: 20px 24px 16px; display: flex; flex-direction: column; }
.list .h3 { font-size: 18px; margin-bottom: 6px; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item .l span:first-child { font-size: 15px; font-weight: 700; }
.item .l span:last-child { font-size: 13px; color: var(--sub); overflow-wrap: anywhere; }
.item > b { font-size: 17px; font-weight: 800; flex: none; }
.item.test .l span:first-child, .item.test > b { color: var(--accent); }
.empty { padding: 40px 0; text-align: center; color: var(--sub); font-size: 15px; }

/* 달력 */
.cal-head { padding: 44px 24px 0; display: flex; justify-content: space-between; align-items: center; }
.cal-head .title { margin: 0; font-size: 22px; }
.cal-nav { display: flex; gap: 4px; }
.cal-nav button { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: var(--sub); border-radius: 20px; }
.cal-nav button:disabled { color: var(--faint); }
.cal-nav svg { width: 20px; height: 20px; }
.cal { padding: 18px 16px 0; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); text-align: center; font-size: 12px; color: var(--sub2); margin-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); row-gap: 6px; }
.day { height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.day .n { width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 500; color: var(--text2); }
.day .d { width: 5px; height: 5px; border-radius: 3px; }
.day.work .d { background: var(--accent); }
.day.test .n { background: var(--accent); color: #fff; font-weight: 800; }
.day.today .n { border: 2px solid var(--text); font-weight: 800; }
.day.sel:not(.test) .n { background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.day.future .n { color: var(--faint); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--sub); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { display: block; width: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.legend i.big { width: 14px; height: 14px; border-radius: 7px; }
.cal-detail { padding: 14px 24px 16px; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--soft); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.card .item { padding: 0; border: 0; }
.card .item > b small { font-size: 14px; margin-left: 2px; }
.text-btn { align-self: flex-start; font-size: 14px; font-weight: 700; color: var(--sub); height: 36px; }
.text-btn.danger { color: var(--danger); }

/* 설정 */
.set-group { margin: 0 24px; border-radius: 16px; background: var(--soft); padding: 4px 18px; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 64px; border-bottom: 1px solid var(--line2); }
.set-row:last-child { border-bottom: 0; }
.set-row .l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-row .l span:first-child { font-size: 16px; font-weight: 700; }
.set-row .l span:last-child:not(:first-child) { font-size: 13px; color: var(--sub); }
.set-row .stepper input { background: #fff; }
.set-row .stepper button { background: #fff; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--track); transition: background 0.2s; pointer-events: none; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15); transition: transform 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.set-row.btn-row { cursor: pointer; width: 100%; text-align: left; }
.set-row.btn-row.danger .l span:first-child { color: var(--danger); }
.gap { height: 14px; }

/* 직접 세기 고르기(운동마다) */
.manual-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 2px 10px; }
.manual-row > span { display: flex; flex-direction: column; gap: 1px; font-size: 15px; font-weight: 700; }
.manual-row small { font-size: 13px; font-weight: 400; color: var(--sub); }

/* 자유 코스 */
.free-list .edit-row .l span:first-child { font-size: 16px; }
.free-tools { display: flex; gap: 10px; }
.free-tools .btn { height: 48px; font-size: 15px; }

/* 아래에서 올라오는 창 */
.sheet-bg { position: absolute; inset: 0; background: rgba(15,20,30,0.42); display: flex; align-items: flex-end; z-index: 10; animation: fade 0.15s ease; }
.sheet { width: 100%; background: #fff; border-radius: 24px 24px 0 0; padding: 24px 24px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 18px; animation: up 0.2s ease; }
.sheet h2 { margin: 0; font-size: 20px; font-weight: 800; }
.sheet p { margin: -8px 0 0; font-size: 15px; color: var(--sub); }
.sheet .stepper { justify-content: center; }
.sheet-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sheet-btns.one { grid-template-columns: 1fr; }
.btn.danger { background: var(--danger); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0.6; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.toast { position: absolute; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: rgba(25,31,40,0.92); color: #fff; font-size: 14px; padding: 10px 16px; border-radius: 12px; z-index: 20; white-space: nowrap; }
