:root {
	--bg: #0c1016;
	--panel: #141b25;
	--panel-2: #1a2230;
	--line: #222d3b;
	--text: #eaf0f7;
	--muted: #8595a8;
	--g1: #ff6b35;
	--g2: #e0218a;
	--grad: linear-gradient(90deg, #ff6b35, #e0218a);
	--radius: 18px;
	--shadow: 0 8px 30px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	font-family: "Inter", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 60px; }

/* sticky section nav */
.nav {
	position: sticky; top: 0; z-index: 20;
	display: flex; gap: 6px; overflow-x: auto;
	padding: 10px 16px; margin-bottom: 6px;
	background: rgba(12, 16, 22, .82); backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
	-webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
	flex: 0 0 auto; text-decoration: none; color: var(--muted);
	font-size: .82rem; font-weight: 700; padding: 6px 14px;
	border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
	transition: .15s;
}
.nav a.active { color: #fff; background: var(--grad); border-color: transparent; }
.block { scroll-margin-top: 56px; }

/* hero / header */
.hero {
	max-width: 880px;
	margin: 0 auto;
	padding: 26px 16px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.hero h1 { margin: 0; font-size: 1.55rem; font-weight: 900; letter-spacing: -.03em; }
.hero-right { display: flex; align-items: center; gap: 10px; }
.refresh-btn {
	width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
	background: var(--panel); border: 1px solid var(--line); color: var(--text);
	font-size: 1.15rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
	transition: .15s;
}
.refresh-btn:active { background: var(--panel-2); transform: scale(.92); }
.refresh-btn.spinning { animation: spin .6s linear infinite; color: var(--g2); }
@keyframes spin { to { transform: rotate(360deg); } }
.hero .sub {
	font-size: .64rem; font-weight: 800; letter-spacing: .04em;
	color: #fff; background: var(--grad);
	padding: 6px 11px; border-radius: 20px; white-space: nowrap;
}

/* gradient text helper */
.grad-num {
	background: var(--grad); -webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
}

/* summary cards */
.cards {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 11px;
	margin-bottom: 24px;
}
.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 16px;
	position: relative;
	overflow: hidden;
}
.card .num {
	font-size: 2rem; font-weight: 900; letter-spacing: -.02em;
	background: var(--grad); -webkit-background-clip: text; background-clip: text;
	-webkit-text-fill-color: transparent;
}
.card .num .u { font-size: .9rem; }
.card .lbl { font-size: .74rem; color: var(--muted); font-weight: 700; margin-top: 2px; }
.card .accent { height: 4px; border-radius: 3px; background: var(--grad); opacity: .85; margin-top: 11px; }

/* sections */
.block {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 18px;
	margin-bottom: 20px;
	box-shadow: var(--shadow);
}
.block h2 {
	margin: 0 0 4px; font-size: 1.02rem; font-weight: 800;
	display: flex; align-items: center; gap: 8px;
}
.block h2 .tag {
	font-size: .64rem; color: var(--muted); font-weight: 700;
	background: var(--panel-2); padding: 3px 8px; border-radius: 12px;
}
.block h2 .tag-btn {
	margin-left: auto; font-size: .68rem; font-weight: 700; color: var(--muted);
	background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
	padding: 4px 10px; cursor: pointer; transition: .15s;
}
.block h2 .tag-btn.on { color: #fff; background: var(--grad); border-color: transparent; }

/* exercise single-select (그룹·전부 노출 줄바꿈) */
.ex-select { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.ex-grp-label {
	display: block; font-size: .66rem; font-weight: 700; letter-spacing: .06em;
	text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.ex-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.ex-select .pill {
	font-size: .8rem; font-weight: 600; padding: 6px 13px; border-radius: 999px;
	cursor: pointer; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); transition: .15s;
}
.ex-select .pill.on { color: #fff; background: var(--grad); border-color: transparent; }

.more-btn {
	display: block; width: 100%; margin-top: 14px; padding: 11px;
	background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
	color: var(--text); font-size: .84rem; font-weight: 700; cursor: pointer; transition: .15s;
}
.more-btn:hover { border-color: var(--g2); }
.more-btn.hidden { display: none; }
.hint { color: var(--muted); font-size: .8rem; margin: 4px 0 14px; }

/* 인바디 */
.ib-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-bottom: 14px; }
.ib-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 15px; }
.ib-num {
	font-size: 1.7rem; font-weight: 900; letter-spacing: -.02em;
	background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ib-num .u { font-size: .8rem; }
.ib-lbl { font-size: .76rem; color: var(--muted); font-weight: 700; margin-top: 3px; }
.ib-delta { font-weight: 800; }
.ib-delta.good { color: #4ade80; }
.ib-delta.bad { color: #f87171; }
.ib-detail { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 6px; }
.ib-chip {
	font-size: .78rem; color: var(--muted); background: var(--panel-2);
	border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
}
.ib-chip b { color: var(--text); font-weight: 800; }

/* routine */
.routine { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.day { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.day h3 {
	margin: 0 0 8px; font-size: .9rem; font-weight: 800;
	background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.day ul { margin: 0; padding: 0; list-style: none; }
.day li { font-size: .86rem; padding: 7px 0; border-bottom: 1px solid var(--line); }
.day li:last-child { border: 0; }
.day .empty { color: var(--muted); font-size: .84rem; font-style: italic; }
.day .pr-date { color: var(--g2); font-size: .7rem; font-weight: 700; opacity: .85; white-space: nowrap; }
.chip {
	display: inline-block; font-size: .72rem; font-weight: 800; color: #fff;
	background: var(--grad); padding: 2px 9px; border-radius: 10px; margin-right: 6px;
}

/* tabs + toggles */
/* 지표 토글 — 트랙 있는 세그먼트 컨트롤(운동 칩과 구분) */
.tabs {
	display: inline-flex; gap: 3px; margin-bottom: 14px;
	background: var(--bg); border: 1px solid var(--line);
	border-radius: 11px; padding: 3px;
}
.tab {
	background: transparent; color: var(--muted);
	border: none; border-radius: 8px;
	padding: 6px 16px; font-size: .82rem; font-weight: 700; cursor: pointer; transition: .15s;
}
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 1px 6px rgba(224,33,138,.35); }
.tab.disabled { opacity: .3; pointer-events: none; }
.toggles { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.toggles .pill {
	font-size: .76rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; cursor: pointer;
	border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); transition: .15s;
}
.toggles .pill.on { color: var(--text); }

.chart-box { position: relative; height: 320px; }
.chart-box.small { height: 280px; }

/* PR grid */
.pr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.pr {
	background: var(--panel-2); border: 1px solid var(--line);
	border-left: 3px solid var(--g1);
	border-radius: 14px; padding: 13px 15px;
}
.pr .name { font-size: .8rem; font-weight: 700; color: var(--muted); }
.pr .val { font-size: 1.7rem; font-weight: 900; margin-top: 3px; }
.pr .val .unit {
	font-size: .78rem; font-weight: 700;
	background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.pr .meta { font-size: .73rem; color: var(--muted); margin-top: 2px; }

/* 마지막 수행 */
.recency { display: flex; flex-direction: column; }
.rec-row {
	display: flex; align-items: center; gap: 10px;
	padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.rec-row:last-child { border: 0; }
.rec-name { flex: 1; font-size: .9rem; font-weight: 600; }
.rec-days {
	font-size: .78rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.rec-days.fresh { color: #4ade80; background: rgba(74,222,128,.12); }
.rec-days.mid { color: #cfe0d5; background: var(--panel-2); }
.rec-days.warn { color: #fbbf24; background: rgba(251,191,36,.12); }
.rec-days.stale { color: #f87171; background: rgba(248,113,113,.14); }
.rec-date { font-size: .74rem; color: var(--muted); width: 44px; text-align: right; }
.rec-pr { font-size: .78rem; font-weight: 700; color: var(--muted); }

/* 중단한 운동 (접이식) */
#sec-inactive summary {
	cursor: pointer; font-size: 1.02rem; font-weight: 800; list-style: none;
	display: flex; align-items: center; gap: 8px;
}
#sec-inactive summary::-webkit-details-marker { display: none; }
#sec-inactive summary::before { content: "▸"; color: var(--muted); transition: .15s; }
#sec-inactive details[open] summary::before { content: "▾"; }
.inactive-count { color: var(--muted); font-weight: 700; font-size: .82rem; }
#sec-inactive .rec-name { color: var(--muted); }

/* timeline */
.timeline { display: flex; flex-direction: column; gap: 14px; }
.session { border-left: 2px solid; border-image: var(--grad) 1; padding: 2px 0 2px 14px; }
.session .date { font-weight: 800; font-size: .95rem; }
.session ul { margin: 6px 0 0; padding-left: 16px; }
.session li { font-size: .85rem; margin: 3px 0; }
.session li .cardio { color: #fbbf24; }
.session li .note { color: var(--muted); font-size: .8rem; }
.session li .badge {
	display: inline-block; font-size: .68rem; font-weight: 800; color: #fff;
	background: var(--grad); border-radius: 6px; padding: 0 6px; margin-left: 6px;
}

.foot {
	text-align: center; color: var(--muted); font-size: .76rem;
	padding: 24px 16px 40px;
}
.foot code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: .74rem; }
.foot .dot { margin: 0 8px; opacity: .5; }

@media (max-width: 560px) {
	.hero h1 { font-size: 1.35rem; }
	.chart-box { height: 280px; }
}
