/* 핏코치 Practice — editorial wellness system with light/dark themes */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  color-scheme: light;
  --page: #f2efe7;
  --surface: #ffffff;
  --surface-2: #e9e5dc;
  --input: #faf8f3;
  --ink: #171a1f;
  --ink-2: #3d3d3a;
  --muted: #6d6b66;
  --grid: #d7d1c5;
  --border: rgba(23,26,31,.12);
  --primary: #171a1f;
  --on-primary: #f7f4ec;
  --accent: #ff5a36;
  /* 소형 텍스트용 액센트 — 밝은 배경에서 WCAG AA(4.5:1) 충족 (#f2efe7 위 4.67:1, #fff 위 5.37:1) */
  --accent-text: #c23a1a;
  --coach: #3157d5;
  --s1: #3157d5;
  --s2: #ff5a36;
  --s3: #178a6d;
  --good: #187c5c;
  --warning: #9b6200;
  --critical: #b8352b;
  --tabbar-bg: rgba(242,239,231,.94);
  --chrome-bg: rgba(242,239,231,.88);
  --shadow: 0 14px 40px rgba(34,31,24,.08);
  --appbar-h: calc(64px + env(safe-area-inset-top));
  --tabbar-h: calc(74px + env(safe-area-inset-bottom));
  --active-tabbar-h: var(--tabbar-h);
  --viewport-h: 100dvh;
  --content-max: 720px;
  --z-appbar: 100;
  --z-chat: 105;
  --z-tabbar: 110;
  --z-install: 200;
  --z-modal: 300;
  --z-toast: 600;
  --z-auth: 4000;
  --z-banner: 5000;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #111318;
  --surface: #191c22;
  --surface-2: #242830;
  --input: #15181e;
  --ink: #f3f0e8;
  --ink-2: #cbc7be;
  --muted: #98938a;
  --grid: #30343c;
  --border: rgba(243,240,232,.11);
  --primary: #f3f0e8;
  --on-primary: #171a1f;
  --accent: #ff6b4a;
  /* 어두운 배경에서는 기본 액센트가 이미 6.6:1로 충분 */
  --accent-text: #ff6b4a;
  --coach: #7894ff;
  --s1: #7894ff;
  --s2: #ff6b4a;
  --s3: #43b895;
  --good: #43b895;
  --warning: #f0b64b;
  --critical: #ff746c;
  --tabbar-bg: rgba(17,19,24,.94);
  --chrome-bg: rgba(17,19,24,.88);
  --shadow: 0 16px 44px rgba(0,0,0,.24);
}
html, body { margin: 0; padding: 0; background: var(--page); color: var(--ink-2);
  font-family: Pretendard, "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100%; overflow-x: hidden; overscroll-behavior-y: none; scrollbar-gutter: stable; }
body { display: flex; flex-direction: column; min-height: var(--viewport-h); font-size: 17px; line-height: 1.55;
  transition: background .2s ease, color .2s ease; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
/* 한국어 어절은 보존하고, 긴 URL/식별자만 필요한 지점에서 줄바꿈한다. */
h1,h2,h3,h4,p,.page-note,.item .t,.item .d,.btn,.sub { word-break: keep-all; overflow-wrap: break-word; text-wrap: pretty; }
.row > *,.grid2 > *,.grid3 > * { min-width: 0; }

/* 브랜드 앱 바 */
#appbar { position: sticky; top: 0; z-index: var(--z-appbar); flex: 0 0 auto; padding-top: env(safe-area-inset-top);
  background: var(--chrome-bg); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.appbar-inner { width: 100%; max-width: var(--content-max); height: 64px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); background: none; border: 0;
  padding: 0; font-size: 17px; font-weight: 800; letter-spacing: -.05em; }
.brand-mark { width: 31px; height: 31px; overflow: visible; }
.brand-start { fill: var(--accent); }
.brand-loop { fill: none; stroke: var(--ink); stroke-width: 10; stroke-linecap: round; }
.brand-coach { fill: none; stroke: var(--coach); stroke-width: 6; stroke-linecap: round; }
.theme-toggle,.app-menu-toggle { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 18px; box-shadow: 0 3px 12px rgba(0,0,0,.04); }
.app-menu-toggle[hidden] { display: none; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
.app-new-chat { color: var(--coach); font-size: 24px; font-weight: 500; }

#banner { position: fixed; top: env(safe-area-inset-top); left: 0; right: 0; z-index: var(--z-banner);
  display: flex; flex-direction: column; align-items: stretch; pointer-events: none; isolation: isolate; }
#banner .msg { min-height: 34px; padding: 7px 12px; text-align: center; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 12px; pointer-events: auto; box-shadow: 0 5px 18px rgba(0,0,0,.16); }
#banner .offline { background: var(--warning); color: #171a1f; }
#banner .update { background: var(--coach); color: #fff; }
#banner .update button { border: 1px solid rgba(255,255,255,.52); border-radius: 3px; background: rgba(0,0,0,.14);
  color: #fff; padding: 4px 9px; font-size: 11px; font-weight: 800; white-space: nowrap; }

#mutation-bar { position: fixed; left: 0; top: 0; width: 0; height: 3px; z-index: calc(var(--z-banner) - 1);
  opacity: 0; background: var(--accent); pointer-events: none; }
#mutation-bar.on { opacity: 1; animation: mutation-progress 1.15s ease-in-out infinite; }
@keyframes mutation-progress { 0% { width: 0; transform: translateX(0); } 55% { width: 72%; transform: translateX(18%); } 100% { width: 24%; transform: translateX(420%); } }

#view { flex: 1; padding: 28px 20px calc(var(--tabbar-h) + 30px); max-width: var(--content-max); width: 100%; margin: 0 auto; overflow-anchor: none; }
#tabbar { position: fixed; bottom: 0; left: 0; right: 0; inset-block-end: 0; z-index: var(--z-tabbar); display: grid;
  grid-template-columns: repeat(5, 1fr); background: var(--tabbar-bg); border-top: 1px solid var(--border);
  height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
#tabbar button { position: relative; background: none; border: 0; color: var(--muted); font-size: 13px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 700; }
#tabbar button .ti { font-size: 22px; line-height: 1; font-family: ui-monospace, SFMono-Regular, monospace; }
#tabbar button.on { color: var(--ink); }
#tabbar button.on::before { content: ""; position: absolute; top: 7px; width: 5px; height: 5px;
  border-radius: 1px; background: var(--accent); }

.page-intro { margin: 2px 0 24px; }
.brand-kicker, .card-label { display: block; color: var(--accent-text); font-size: 12px; line-height: 1;
  font-weight: 800; letter-spacing: .12em; margin-bottom: 10px; }
h1.page { color: var(--ink); font-size: clamp(30px, 7vw, 38px); line-height: 1.16; margin: 3px 0 24px; letter-spacing: -.05em; font-weight: 780; }
.page-intro h1.page { margin-bottom: 7px; }
.page-note { color: var(--muted); font-size: 16px; line-height: 1.6; margin: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 0 rgba(0,0,0,.015); }
.card h2 { color: var(--ink); font-size: 20px; margin: 0 0 14px; letter-spacing: -.025em; font-weight: 730; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 14px; }
.sub { color: var(--ink-2); font-size: 16px; }

/* 스탯 타일 */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 13px; }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px; min-height: 112px; }
.tile .v { color: var(--ink); font-size: 30px; font-weight: 760; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 12px; font-weight: 550; color: var(--muted); }
.tile .l { font-size: 14px; color: var(--muted); margin-top: 7px; line-height: 1.45; }
.tile.accent::before { content: ""; position: absolute; top: 13px; right: 13px; width: 8px; height: 8px; background: var(--accent); border-radius: 1px; }
.delta-up { color: var(--good); font-size: 12px; font-weight: 700; }
.delta-down { color: var(--critical); font-size: 12px; font-weight: 700; }

/* 버튼 */
.btn { background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); border-radius: 6px;
  padding: 14px 18px; font-size: 16px; font-weight: 730; width: 100%; min-height: 50px; }
.btn:active { transform: translateY(1px); }
.btn.sm { width: auto; min-height: 40px; padding: 9px 13px; font-size: 14px; border-radius: 5px; }
.btn.ghost { background: var(--surface-2); color: var(--ink); border-color: transparent; }
.btn.danger { background: transparent; color: var(--critical); border-color: color-mix(in srgb,var(--critical) 70%,transparent); }
.btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.btn:disabled { opacity: .42; }
.btnrow { display: flex; gap: 8px; margin-top: 10px; }
.btnrow .btn { flex: 1; }

/* 칩과 세그먼트 */
.chips { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 11px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: transparent; color: var(--ink-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 15px; font-size: 14px; font-weight: 650; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(88px,1fr); overflow-x: auto; scrollbar-width: none; background: var(--surface-2); border-radius: 4px; padding: 3px; gap: 3px; margin-bottom: 13px; }
.seg::-webkit-scrollbar { display: none; }
.seg button { background: none; border: 0; color: var(--muted); font-size: 14px; font-weight: 700; padding: 11px 5px; border-radius: 3px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.08); }
.theme-card .sub { display: block; margin: -3px 0 14px; line-height: 1.55; }
.theme-seg { margin-bottom: 0; }
.preference-card { display: grid; gap: 18px; }
.preference-block { min-width: 0; }
.preference-block + .preference-block { padding-top: 18px; border-top: 1px solid var(--grid); }
.preference-block h2 { margin: 0 0 7px; color: var(--ink); font-size: 18px; }
.preference-block .sub { margin: 0 0 12px; }
.locale-seg { margin: 0; }
.profile-form-card { display: grid; gap: 16px; padding: 20px; overflow: hidden; }
.profile-form-card > h2 { margin: -5px 0 1px; color: var(--ink); font-size: 23px; letter-spacing: -.035em; }
.profile-form-card .card-label { margin: 0; }
.profile-field { min-width: 0; }
.profile-field > label.f { margin-top: 0; color: var(--ink-2); font-weight: 680; line-height: 1.45; word-break: keep-all; }
.profile-compact-grid,.profile-reference-grid { min-width: 0; }
.profile-section-note { margin: -5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.profile-chip-grid { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.profile-choice-chip { min-height: 42px; max-width: 100%; padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 680; line-height: 1.3; text-align: left; overflow-wrap: anywhere; }
.profile-choice-chip.on { border-color: var(--primary); background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 1px var(--primary); }
.profile-choice-chip:focus-visible { outline: 3px solid color-mix(in srgb,var(--coach) 28%,transparent); outline-offset: 2px; }
.profile-reference-note { margin: 0; }
.profile-source-link { width: fit-content; color: var(--coach); font-size: 13px; font-weight: 700; text-underline-offset: 3px; }
.profile-save-button { min-height: 58px; margin: 2px 0 8px; font-size: 17px; }
.coach-status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.coach-status-grid > div { background: var(--input); border: 1px solid var(--border); border-radius: 4px; padding: 11px; }
.coach-status-grid span, .coach-status-grid strong { display: block; }
.coach-status-grid strong { color: var(--ink); font-size: 13px; margin-top: 5px; font-weight: 730; }
.coach-status-note { margin: 12px 0 0; line-height: 1.55; }

/* 목록 */
.item { display: flex; align-items: center; gap: 11px; padding: 13px 1px; border-bottom: 1px solid var(--grid); }
.item:last-child { border-bottom: 0; }
.item .grow { flex: 1; min-width: 0; }
.item .t { color: var(--ink); font-size: 16px; font-weight: 680; }
.item .d { color: var(--muted); font-size: 14px; margin-top: 4px; line-height: 1.45; }
.badge { font-size: 12px; font-weight: 760; padding: 5px 8px; border-radius: 3px; flex: 0 0 auto; }
.badge.b1 { background: color-mix(in srgb,var(--coach) 14%,transparent); color: var(--coach); }
.badge.b2 { background: color-mix(in srgb,var(--accent) 14%,transparent); color: var(--accent); }
.badge.b3 { background: color-mix(in srgb,var(--s3) 14%,transparent); color: var(--s3); }
.badge.warn { background: color-mix(in srgb,var(--warning) 14%,transparent); color: var(--warning); }
.stars { color: var(--warning); font-size: 11px; letter-spacing: 1px; }

/* 채팅 */
#chat-scroll { display: flex; flex-direction: column; gap: 12px; padding-bottom: 78px; }
.bubble { max-width: 88%; border-radius: 5px; padding: 12px 14px; font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; }
.bubble.user { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 1px; }
.bubble.coach { align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--coach); color: var(--ink-2); border-bottom-left-radius: 1px; }
.bubble.coach b, .bubble.coach strong { color: var(--ink); }
.bubble img { max-width: 200px; border-radius: 3px; display: block; }
.uiblock { align-self: stretch; max-width: 100%; }
.tool-note { align-self: flex-start; color: var(--muted); font-size: 11px; padding-left: 6px; }
#chat-input-bar { position: fixed; bottom: var(--tabbar-h); left: 0; right: 0; z-index: var(--z-chat);
  background: var(--chrome-bg); border-top: 1px solid var(--border); padding: 8px 12px;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
#chat-input-bar .inner { max-width: 640px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
#chat-text { flex: 1; background: var(--input); border: 1px solid var(--border); border-radius: 18px;
  color: var(--ink); font-size: 15px; padding: 10px 14px; resize: none; max-height: 110px; font-family: inherit; line-height: 1.4; }
#chat-text:focus { outline: 2px solid color-mix(in srgb,var(--coach) 28%,transparent); border-color: var(--coach); }
.iconbtn { background: var(--surface); border: 1px solid var(--border); color: var(--ink); width: 40px; height: 40px;
  border-radius: 50%; font-size: 16px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; }
.iconbtn.rec { background: var(--critical); color: #fff; border-color: var(--critical); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .58; } }
.thumb-strip { display: flex; gap: 6px; padding: 0 4px 8px; }
.thumb-strip img { width: 52px; height: 52px; object-fit: cover; border-radius: 3px; }

/* 생성형 UI 블록 */
.gen { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 15px; }
.gen[data-phase="active"], .gen[data-phase="rest"] { scroll-margin-top: calc(72px + env(safe-area-inset-top)); }
.gen h3 { color: var(--ink); font-size: 14px; margin: 0 0 10px; }
.bignum { color: var(--ink); font-size: 46px; font-weight: 760; letter-spacing: -.055em; text-align: center; font-variant-numeric: tabular-nums; }
.timer-bar { height: 5px; background: var(--surface-2); border-radius: 0; overflow: hidden; margin: 12px 0; }
.timer-bar > div { height: 100%; background: var(--accent); transition: width .3s linear; }
.counter-pad { background: var(--input); border: 1px dashed var(--border); border-radius: 4px; padding: 22px; text-align: center; user-select: none; -webkit-user-select: none; }
.plan-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.plan-item:last-child { border-bottom: 0; }
.plan-item input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--good); margin-top: 2px; }
.plan-item .nm { color: var(--ink); font-size: 14px; font-weight: 680; }
.plan-item .meta { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.vlink { color: var(--coach); font-size: 12px; font-weight: 700; text-decoration: none; }
.check-item { display: flex; gap: 10px; align-items: center; padding: 8px 0; font-size: 13.5px; }
input[type=checkbox] { accent-color: var(--accent); }

/* 차트 */
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; background: var(--ink); border: 0; border-radius: 3px; padding: 6px 9px;
  font-size: 11px; color: var(--page); pointer-events: none; transform: translate(-50%, -110%); white-space: nowrap; display: none; }

/* 폼 */
label.f { display: block; font-size: 14px; color: var(--muted); margin: 13px 0 6px; }
input.f, select.f, textarea.f { width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: 6px;
  color: var(--ink); font-size: 17px; min-height: 48px; padding: 12px 13px; font-family: inherit; }
input.f:focus, select.f:focus, textarea.f:focus { outline: 2px solid color-mix(in srgb,var(--coach) 24%,transparent); border-color: var(--coach); }
input.f::placeholder, textarea.f::placeholder { color: var(--muted); opacity: .8; }
.profile-grow-field { min-height: 58px; max-height: 220px; resize: none; overflow-y: hidden; line-height: 1.5; transition: border-color .15s ease, outline-color .15s ease; }
.auto-grow-field { min-height: 52px; max-height: 240px; resize: none; overflow-y: hidden; line-height: 1.5; field-sizing: content; }
.workout-set-section { margin-top: 16px; }
.workout-set-section-head { margin-bottom: 10px; }
.workout-set-section-head strong,.workout-set-section-head small { display: block; }
.workout-set-section-head strong { color: var(--ink); font-size: 16px; }
.workout-set-section-head small { margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.workout-set-builder { display: grid; gap: 10px; }
.workout-set-card { padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.workout-set-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.workout-set-head > strong { color: var(--ink); font-size: 15px; }
.workout-set-order { display: flex; align-items: center; gap: 4px; }
.workout-set-order button { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.workout-set-order button.danger { color: var(--critical); font-size: 12px; font-weight: 750; }
.workout-set-order button:disabled { opacity: .3; }
.workout-set-card label > span { display: block; margin: 0 0 5px 2px; color: var(--muted); font-size: 11px; font-weight: 720; }
.workout-set-card .f { min-height: 44px; padding: 9px 10px; font-size: 15px; background: var(--surface); }
.workout-set-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin-top: 9px; }
.workout-set-note { display: block; margin-top: 9px; }
.workout-set-duplicate { width: 100%; min-height: 38px; margin-top: 9px; border: 1px dashed var(--border); border-radius: 8px; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.workout-set-add { width: 100%; margin-top: 10px; }
.workout-set-empty { display: grid; gap: 3px; padding: 20px 14px; border: 1px dashed var(--border); border-radius: 12px; text-align: center; color: var(--muted); }
.workout-set-empty strong { color: var(--ink); font-size: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* 모달 */
body.modal-sheet-open { overflow: hidden; }
#modal-root .scrim { position: fixed; inset: 0; background: rgba(8,9,12,.62); z-index: var(--z-modal); }
#modal-root .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: calc(var(--z-modal) + 1); background: var(--page);
  border-radius: 10px 10px 0 0; border-top: 1px solid var(--border); box-shadow: var(--shadow); max-height: 88dvh;
  overflow-y: auto; overscroll-behavior-y: contain; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto;
  will-change: transform; animation: sheet-rise .22s cubic-bezier(.22,.8,.24,1); }
#modal-root .sheet.dragging { transition: none; user-select: none; }
#modal-root .sheet.settling { transition: transform .22s cubic-bezier(.22,.8,.24,1); }
#modal-root .scrim { transition: opacity .22s ease; animation: scrim-in .18s ease; }
.sheet .grab { width: 46px; height: 5px; border-radius: 999px; background: var(--grid); margin: -2px auto 16px; touch-action: none; cursor: grab; }
.sheet.dragging .grab { cursor: grabbing; }
.sheet h2 { color: var(--ink); font-size: 18px; margin: 0 0 12px; letter-spacing: -.035em; }
@keyframes sheet-rise { from { transform: translate3d(0,32px,0); opacity: .72; } }
@keyframes scrim-in { from { opacity: 0; } }

/* 트래킹 및 기타 */
.track-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; text-align: center; }
.track-stats .v { color: var(--ink); font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; }
.track-stats .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
#map { height: 260px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); }
.gps-status { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 8px 4px 0; color: var(--muted); font-size: 13px; font-weight: 650; }
.gps-status i { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.gps-status.good { color: var(--good); }
.gps-status.good i { background: var(--good); }
.gps-status.searching,.gps-status.weak { color: var(--warning); }
.gps-status.searching i,.gps-status.weak i { background: var(--warning); }
.gps-status.bad { color: var(--critical); }
.gps-status.bad i { background: var(--critical); }
.route-warning { margin: 12px 0; padding: 11px 12px; border: 1px solid color-mix(in srgb,var(--warning) 42%,var(--border)); border-radius: 7px;
  background: color-mix(in srgb,var(--warning) 9%,var(--surface)); color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 0; line-height: 1.7; }
.toast { position: fixed; bottom: calc(var(--tabbar-h) + 14px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--page); font-size: 13px; padding: 10px 16px; border-radius: 4px; z-index: var(--z-toast);
  box-shadow: var(--shadow); max-width: calc(100vw - 32px); text-align: center; }
.videobox { position: relative; padding-top: 56.25%; border-radius: 4px; overflow: hidden; background: #000; margin-top: 10px; }
.videobox iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.youtube-sound-control { position: absolute; z-index: 3; top: 10px; right: 10px; min-height: 38px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.38); border-radius: 999px; background: rgba(9,11,15,.86); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.3); font-size: 13px; font-weight: 780; }
.youtube-sound-control.pending { opacity: .78; }
.youtube-sound-control.confirmed { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease,visibility 0s linear .2s; }
.install-chip { position: fixed; bottom: calc(var(--tabbar-h) + 12px); left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #171a1f; border: 0; border-radius: 4px; padding: 11px 17px;
  font-size: 13px; font-weight: 760; z-index: var(--z-install); box-shadow: var(--shadow); }

/* PWA 내부 재인증 — 현재 화면과 요청을 유지한 채 세션만 복구한다. */
.auth-locked body { overflow: hidden; }
#auth-root { display: none; }
#auth-root.open { display: block; position: fixed; inset: 0; z-index: var(--z-auth); }
.auth-scrim { position: absolute; inset: 0; background: rgba(8,9,12,.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.auth-gate { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(380px,calc(100vw - 32px));
  max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 7px; padding: 25px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.auth-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 30px; font-weight: 800; letter-spacing: -.04em; }
.auth-brand-dot { width: 13px; height: 13px; background: var(--accent); border-radius: 2px; box-shadow: 15px 9px 0 -3px var(--coach); }
.auth-gate h2 { margin: 0 0 8px; font-size: 24px; letter-spacing: -.045em; }
.auth-reason { margin: 0 0 19px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.auth-form .btn { margin-top: 14px; }
.google-auth { width:100%; margin-top:12px; background:var(--surface); color:var(--ink); border:1px solid var(--border); }
.auth-divider { display:flex; align-items:center; gap:10px; margin:16px 0 4px; color:var(--muted); font-size:11px; }
.auth-divider::before,.auth-divider::after { content:""; height:1px; background:var(--border); flex:1; }
.auth-error { min-height: 20px; margin-top: 10px; color: var(--critical); font-size: 12px; text-align: center; }

/* 공통 optimistic 상태 */
.optimistic-pending { opacity: .52; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.optimistic-remove { opacity: 0; transform: translateX(12px); pointer-events: none; }
.optimistic-saved { outline: 2px solid color-mix(in srgb,var(--good) 40%,transparent); }
.optimistic-error { animation: optimistic-error .32s ease-in-out; }
@keyframes optimistic-error { 25% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }

@media (max-width: 380px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .btnrow { gap: 6px; }
  .btn { padding-left: 11px; padding-right: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}

/* 하단 메뉴는 모든 탭에서 동일한 viewport-fixed 요소다. 코치 탭은 메뉴를
   움직이지 않고 중앙 채팅 영역만 상단바와 메뉴 사이에 고정한다. */
body[data-page="coach"] { overflow: hidden; }
body.keyboard-open { --active-tabbar-h: 0px; }
body.keyboard-open #tabbar { transform: translate3d(0,110%,0); opacity: 0; visibility: hidden; pointer-events: none; }
#tabbar { width: 100%; max-width: 100vw; transition: transform .18s ease, opacity .14s ease; contain: layout paint; backface-visibility: hidden; }
#appbar, #tabbar, #chat-input-bar { transform: translateZ(0); }
html[data-route="coach"] #view {
  position: fixed;
  top: var(--appbar-h); bottom: var(--active-tabbar-h); left: 0; right: 0;
  width: 100%; height: auto; min-height: 0; max-width: var(--content-max); margin: 0 auto; padding: 0; overflow: hidden;
}
html[data-route="coach"] body.keyboard-open #view {
  position: absolute; top: 0; bottom: auto; height: var(--viewport-h);
}
#view[data-page="coach"] {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-width: var(--content-max);
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
.chat-stage, #chat-scroll, #chat-input-bar, .composer-shell, #chat-input-bar .inner {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.chat-stage { position: relative; min-height: 0; overflow: hidden; touch-action: pan-y; }
#chat-scroll { height: 100%; min-height: 0; overflow-y: scroll; overscroll-behavior: contain; scroll-behavior: auto;
  display: flex; flex-direction: column; gap: 16px; padding: 18px 20px max(38px,calc(env(safe-area-inset-bottom) + 26px)); scrollbar-gutter: stable;
  touch-action: pan-y; -webkit-overflow-scrolling: touch; overflow-anchor: none; }
.message-row { display: flex; flex: 0 0 auto; flex-direction: column; min-height: min-content; max-width: min(92%, 620px); animation: message-in .16s ease-out; }
.message-row.user { align-self: flex-end; align-items: flex-end; }
.message-row.assistant { align-self: flex-start; align-items: flex-start; width: min(92%, 620px); }
.message-row .bubble { flex: 0 0 auto; max-width: 100%; border-radius: 14px; padding: 14px 16px; font-size: 17px; line-height: 1.68; white-space: normal; word-break: keep-all; overflow-wrap: break-word; text-wrap: pretty; }
#chat-end-sentinel { display: block; flex: 0 0 2px; width: 100%; height: 2px; pointer-events: none; }
.message-content code,.message-content pre,.message-content a { overflow-wrap: anywhere; word-break: break-word; }
.message-row.user .bubble { background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.message-row.assistant .bubble { width: 100%; background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); border-left: 3px solid var(--coach); border-bottom-left-radius: 4px; }
.message-content > :first-child { margin-top: 0; }
.message-content > :last-child { margin-bottom: 0; }
.message-content p { margin: 0 0 12px; }
.message-content ul, .message-content ol { margin: 8px 0 12px; padding-left: 23px; }
.message-content li + li { margin-top: 5px; }
.message-content h2, .message-content h3, .message-content h4 { margin: 18px 0 8px; color: var(--ink); line-height: 1.35; letter-spacing: -.025em; }
.message-content h2 { font-size: 21px; }
.message-content h3 { font-size: 19px; }
.message-content h4 { font-size: 17px; }
.message-content hr { height: 1px; margin: 16px 0; border: 0; background: var(--border); }
.message-content blockquote { margin: 10px 0; padding: 9px 12px; border-left: 3px solid var(--coach); background: var(--input); color: var(--muted); }
.message-content code { padding: 2px 5px; border-radius: 4px; background: var(--surface-2); font: .88em ui-monospace,SFMono-Regular,monospace; }
.message-content pre { max-width: 100%; overflow-x: auto; padding: 12px; border-radius: 7px; background: var(--input); }
.message-content pre code { padding: 0; background: none; }
.md-gap { height: 5px; }
.md-table-wrap { width: 100%; max-width: 100%; margin: 10px 0 14px; overflow-x: auto; border: 1px solid var(--border); border-radius: 7px; overscroll-behavior-x: contain; }
.md-table-wrap table { width: 100%; min-width: 420px; border-collapse: collapse; font-size: 14px; line-height: 1.45; }
.md-table-wrap th, .md-table-wrap td { padding: 9px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.md-table-wrap th { color: var(--ink); background: var(--surface-2); font-weight: 750; white-space: nowrap; }
.md-table-wrap td:last-child, .md-table-wrap th:last-child { border-right: 0; }
.md-table-wrap tbody tr:last-child td { border-bottom: 0; }
.message-row .bubble img { width: min(100%, 360px); max-height: 420px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 9px; margin-bottom: 10px; background: var(--surface-2); }
.message-meta { display: flex; align-items: center; gap: 10px; min-height: 27px; padding: 4px 4px 0; color: var(--muted); font-size: 12px; }
.message-actions { display: flex; gap: 4px; opacity: .18; transition: opacity .15s ease; }
.message-row:hover .message-actions, .message-row:focus-within .message-actions, .message-row.failed .message-actions { opacity: 1; }
.message-actions button { min-height: 26px; padding: 2px 7px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; }
.message-actions button:hover { background: var(--surface-2); color: var(--ink); }
.message-row.pending { opacity: .78; }
.message-row.pending .bubble { background-size: 220% 100%; animation: pending-breathe 1.25s ease-in-out infinite; }
.message-row.failed .bubble { border-color: color-mix(in srgb,var(--critical) 44%,var(--border)); }
.message-row.streaming .message-content:empty::before { content: ""; display: inline-block; width: 36px; height: 10px;
  background: radial-gradient(circle closest-side,var(--muted) 90%,transparent) 0 50%/33.333% 100% repeat-x; animation: thinking .9s infinite linear; }
.message-row.streaming .bubble { position: relative; min-height: 54px; display: flex; align-items: center; overflow: hidden; }
.message-row.streaming .bubble::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg,var(--coach),var(--accent),var(--coach)); background-size: 100% 220%; animation: coach-stream 1.15s linear infinite; }
.message-row.streaming .message-status::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 6px;
  border: 1.5px solid var(--border); border-top-color: var(--coach); border-radius: 50%; animation: spin .7s linear infinite; }
.profile-answer { display: grid; gap: 9px; width: 100%; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.profile-answer label { color: var(--ink); font-size: 13px; line-height: 1.4; font-weight: 760; }
.profile-answer-input { width: 100%; min-height: 42px; max-height: 104px; padding: 9px 11px; resize: none; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 9px; outline: 0; background: var(--input); color: var(--ink); font: inherit; font-size: 15px; line-height: 1.45; }
.profile-answer-input:focus { border-color: var(--coach); box-shadow: 0 0 0 2px color-mix(in srgb,var(--coach) 16%,transparent); }
.profile-answer-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.profile-answer-suggestions { display: flex; flex: 1 1 auto; flex-wrap: wrap; gap: 6px; }
.profile-answer-suggestions button { min-height: 32px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 680; }
.profile-answer-suggestions button:hover { border-color: var(--coach); color: var(--coach); }
.profile-answer-send { flex: 0 0 auto; min-height: 34px; padding: 7px 11px; border: 0; border-radius: 8px;
  background: var(--coach); color: #fff; font-size: 12px; font-weight: 780; }
.profile-answer-send:disabled { opacity: .42; }
.profile-answer.submitting { opacity: .68; pointer-events: none; }
.profile-answer.answered { display: none; }
@media (max-width: 420px) {
  .profile-answer-bottom { align-items: stretch; flex-direction: column; }
  .profile-answer-send { width: 100%; }
}
.session-divider { align-self: stretch; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; }
.session-divider::before,.session-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }.session-divider span { white-space: nowrap; }
@keyframes thinking { 50% { opacity: .35; transform: translateY(-2px); } }
@keyframes coach-stream { to { background-position: 0 -220%; } }
@keyframes pending-breathe { 50% { filter: brightness(1.07); transform: translateY(-1px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(5px); } }
.chat-jump { position: absolute; right: 18px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; font-size: 20px; }
.chat-jump.on { opacity: 1; transform: none; pointer-events: auto; }
.chat-history-notice { position: absolute; z-index: 2; left: 50%; bottom: 12px; display: none; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 8px 9px 8px 12px;
  transform: translateX(-50%); border: 1px solid var(--border); border-radius: 999px; background: var(--chrome-bg); box-shadow: var(--shadow); color: var(--muted); font-size: 11px; white-space: nowrap; }
.chat-history-notice.on { display: flex; }.chat-history-notice strong { color: var(--ink); font-size: 12px; }.chat-history-notice button { padding: 6px 9px; border: 0; border-radius: 999px; background: var(--coach); color: #fff; font-size: 11px; font-weight: 750; }
.chat-loading { display: grid; gap: 12px; padding-top: 14px; }
.chat-loading span { display: block; width: 72%; height: 64px; border-radius: 12px; background: linear-gradient(90deg,var(--surface),var(--surface-2),var(--surface)); background-size: 220% 100%; animation: skeleton 1.2s infinite; }
.chat-loading span:nth-child(2) { width: 58%; margin-left: auto; }
.chat-loading span:nth-child(3) { width: 82%; }
@keyframes skeleton { to { background-position: -220% 0; } }
.skeleton, .list-skeleton { border-color: transparent; background: linear-gradient(90deg,var(--surface),var(--surface-2),var(--surface)); background-size: 220% 100%; animation: skeleton 1.2s infinite; }
.loading-state { display: grid; place-items: center; align-content: center; gap: 12px; min-height: 170px; padding: 22px; color: var(--muted); text-align: center; }
.loading-state.compact { min-height: 108px; padding: 16px; }
.loading-state strong { font-size: 13px; font-weight: 720; }
.loading-orbit { position: relative; display: block; width: 34px; height: 34px; animation: loading-orbit-spin 1.2s linear infinite; }
.loading-orbit i { position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--coach); box-shadow: 0 0 12px color-mix(in srgb,var(--coach) 48%,transparent); }
.loading-orbit i:nth-child(1) { left: 13px; top: 0; }.loading-orbit i:nth-child(2) { right: 1px; bottom: 4px; background: var(--accent); }.loading-orbit i:nth-child(3) { left: 1px; bottom: 4px; opacity: .45; }
.loading-label.is-loading { display: inline-flex; align-items: center; gap: 7px; }
.loading-label.is-loading::before,button[aria-busy="true"]::before { content: ''; flex: 0 0 auto; width: 11px; height: 11px; border: 2px solid color-mix(in srgb,currentColor 25%,transparent); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes loading-orbit-spin { to { transform: rotate(1turn); } }
.home-skeleton { display: grid; gap: 16px; }
.home-hero-skeleton { min-height: 230px; border-radius: 14px; }
.home-insight-skeleton { min-height: 430px; }
.home-week-skeleton { min-height: 160px; }
.home-actions-skeleton { min-height: 130px; border-radius: 12px; }
.profile-skeleton { display: grid; gap: 14px; min-height: 700px; }.profile-title-skeleton { width: 58%; min-height: 46px; border-radius: 8px; }.profile-skeleton .short { min-height: 120px; }.profile-skeleton .tall { min-height: 220px; }
.list-skeleton { min-height: 330px; }
.stats-results { min-height: 430px; }
.stats-chart-skeleton { min-height: 200px; margin-bottom: 14px; }
.stats-summary-skeleton { min-height: 360px; margin: 16px 0; border-radius: 14px; }
.stats-overview { margin: 16px 0; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.stats-overview-head,.stats-chart-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.stats-overview-head h2,.stats-chart-head h2 { margin: 3px 0 0; }.stats-weight-change { flex: 0 0 auto; padding: 7px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 750; }
.stats-kpi-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-top: 16px; }
.stats-kpi { min-width: 0; padding: 14px; border-radius: 10px; background: var(--surface-2); }.stats-kpi > span,.stats-kpi > strong,.stats-kpi > small { display: block; }
.stats-kpi > span { color: var(--muted); font-size: 12px; font-weight: 700; }.stats-kpi > strong { margin-top: 5px; color: var(--ink); font-size: clamp(18px,5vw,25px); line-height: 1.15; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }.stats-kpi > small { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.stats-chart-card { margin-top: 12px; }.stats-chart-head { align-items: baseline; margin-bottom: 10px; }.stats-chart-head h2 { min-width: 0; font-size: 18px; }.stats-chart-head strong { flex: 0 0 auto; color: var(--coach); font-size: 14px; font-variant-numeric: tabular-nums; }
@media (min-width: 700px) { .stats-kpi-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } }
.device-list-slot { min-height: 64px; }
.device-row-skeleton { min-height: 64px; border-radius: 8px; }
.compact-empty { min-height: 64px; display: grid; place-items: center; }
.chat-welcome { margin: auto 0; padding: 26px 0; }
.chat-welcome h2 { margin: 0 0 9px; color: var(--ink); font-size: clamp(24px,6vw,32px); letter-spacing: -.04em; }
.chat-welcome p { margin: 0 0 20px; color: var(--muted); font-size: 16px; line-height: 1.6; }
.prompt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.prompt-grid button { min-height: 52px; padding: 11px 13px; text-align: left; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 670; }
#chat-input-bar { position: relative; inset: auto; z-index: var(--z-chat); flex: 0 0 auto;
  padding: 5px max(8px,env(safe-area-inset-right)) 5px max(8px,env(safe-area-inset-left));
  background: var(--chrome-bg); border-top: 1px solid var(--border); contain: layout paint; }
body.keyboard-open #chat-input-bar { padding-bottom: 8px; }
.composer-shell { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: 5px;
  border: 1px solid var(--border); border-radius: 15px; background: var(--surface);
  box-shadow: 0 4px 16px rgba(0,0,0,.06); transition: border-color .18s ease,box-shadow .18s ease; }
.composer-shell:focus-within { border-color: var(--coach); box-shadow: 0 0 0 2px color-mix(in srgb,var(--coach) 18%,transparent),0 4px 16px rgba(0,0,0,.06); }
#chat-input-bar.sending .composer-shell { border-color: color-mix(in srgb,var(--coach) 68%,var(--border)); box-shadow: 0 4px 18px rgba(0,0,0,.08),0 0 0 2px color-mix(in srgb,var(--coach) 12%,transparent); animation: composer-live 1.4s ease-in-out infinite; }
@keyframes composer-live { 50% { box-shadow: 0 4px 18px rgba(0,0,0,.08),0 0 0 3px color-mix(in srgb,var(--coach) 20%,transparent); } }
#chat-input-bar .inner { display: block; max-width: none; padding: 0; border: 0; border-radius: 10px; background: var(--input); box-shadow: none; }
#chat-input-bar .inner:focus-within { border-color: transparent; box-shadow: none; }
#chat-text { display: block; width: 100%; min-width: 0; min-height: 38px; max-height: 102px; margin: 0; padding: 7px 10px; border: 0; outline: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font-size: 16px; line-height: 1.35; overflow-y: auto; resize: none; }
#chat-text:focus { border: 0; outline: 0; box-shadow: none; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 36px; padding: 2px 0 0; }.composer-tools { display: flex; align-items: center; gap: 0; }
.iconbtn { width: 34px; height: 34px; padding: 0; border-color: transparent; background: transparent; font-size: 16px; touch-action: manipulation; box-shadow: none; }
.iconbtn.send { width: 36px; height: 36px; background: var(--coach); color: #fff; border-color: var(--coach); font-size: 20px; font-weight: 800; }
.iconbtn.send.stop { background: var(--critical); border-color: var(--critical); font-size: 12px; }
.iconbtn:disabled { opacity: .38; cursor: default; }
.composer-hint { display: none; }
.thumb-strip { display: none; gap: 9px; padding: 2px 50px 9px; overflow-x: auto; }
.thumb-strip.on { display: flex; }
.coach-context-chip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; padding: 7px 10px 7px 12px; border-radius: 10px; background: color-mix(in srgb,var(--coach) 12%,var(--surface)); color: var(--coach); font-size: 12px; font-weight: 750; }
.coach-context-chip button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb,var(--coach) 16%,transparent); color: var(--coach); font-size: 17px; }

/* 코치 앱바 메뉴와 날짜별 대화 서랍 */
.drawer-scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(8,9,12,.46); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.coach-drawer { position: fixed; z-index: calc(var(--z-modal) + 1); top: 0; right: 0; width: min(86vw,360px); height: var(--viewport-h); padding: max(18px,env(safe-area-inset-top)) 16px max(20px,env(safe-area-inset-bottom)); overflow-y: auto; background: var(--page); border-left: 1px solid var(--border); box-shadow: -20px 0 60px rgba(0,0,0,.18); }
.coach-drawer-head { display: flex; align-items: center; justify-content: space-between; min-height: 46px; margin-bottom: 12px; }.coach-drawer-head strong { color: var(--ink); font-size: 24px; }.coach-drawer-head button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 24px; }
.drawer-new-session,.drawer-history-shortcut { width: 100%; display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; margin-bottom: 8px; padding: 14px 12px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); }.drawer-new-session > span,.drawer-history-shortcut > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb,var(--coach) 14%,var(--surface)); color: var(--coach); font-size: 21px; }.drawer-new-session strong,.drawer-new-session small,.drawer-history-shortcut strong,.drawer-history-shortcut small { display: block; }.drawer-new-session strong,.drawer-history-shortcut strong { font-size: 16px; }.drawer-new-session small,.drawer-history-shortcut small { margin-top: 2px; color: var(--muted); font-size: 11px; }.drawer-history-shortcut.on { border-color: var(--coach); }
.drawer-profile-wizard { margin-top: 8px; }.drawer-section-label { margin: 22px 4px 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.drawer-history { display: grid; gap: 4px; }.drawer-history button { width: 100%; display: flex; justify-content: space-between; align-items: center; min-height: 48px; padding: 10px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); text-align: left; }.drawer-history button.on { background: var(--surface-2); }.drawer-history span { font-size: 15px; font-weight: 700; }.drawer-history small { color: var(--muted); font-size: 12px; }
.thumb { position: relative; flex: 0 0 auto; width: 66px; height: 66px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.thumb button { position: absolute; top: -7px; right: -7px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--ink); color: var(--page); font-size: 17px; line-height: 1; }
.thumb.loading::after { content: ""; position: absolute; inset: 0; border-radius: 8px; background: color-mix(in srgb,var(--page) 56%,transparent); }
.uiblock { flex: 0 0 auto; }
.gen { border-radius: 8px; font-size: 16px; }
.gen h3 { font-size: 18px; }
.plan-item .nm { font-size: 17px; }
.plan-item .meta { font-size: 14px; line-height: 1.5; }
.empty { font-size: 16px; }
.toast { font-size: 15px; padding: 12px 18px; border-radius: 7px; }
.optimistic-pending { opacity: .6; pointer-events: none; cursor: wait; }

/* 개인화 홈 브리핑 */
.briefing-hero { position: relative; overflow: hidden; margin-bottom: 16px; padding: clamp(24px,6vw,34px); border: 1px solid color-mix(in srgb,var(--coach) 35%,var(--border));
  border-radius: 14px; background: linear-gradient(145deg,color-mix(in srgb,var(--coach) 15%,var(--surface)),var(--surface) 68%); }
.briefing-hero::after { content: ""; position: absolute; width: 180px; height: 180px; right: -75px; top: -85px; border-radius: 50%;
  background: color-mix(in srgb,var(--accent) 16%,transparent); filter: blur(2px); }
.briefing-focus { position: relative; z-index: 1; color: var(--ink); font-size: clamp(32px,8vw,48px); line-height: 1.05; font-weight: 820; letter-spacing: -.055em; }
.briefing-hero p { position: relative; z-index: 1; max-width: 580px; margin: 13px 0 18px; color: var(--ink-2); font-size: 17px; line-height: 1.65; }
.goal-chip { display: inline-flex; margin-bottom: 18px; padding: 7px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; }
.briefing-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.briefing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.insight-card { min-width: 0; }
.insight-card h2 { margin-bottom: 18px; }
.week-count { color: var(--ink); font-size: 18px; font-weight: 780; }
.body-heatmap { display: grid; grid-template-columns: 128px minmax(0,1fr); align-items: center; gap: 18px; }
.body-silhouette { position: relative; width: 104px; height: 210px; margin: 0 auto; }
.body-head { position: absolute; left: 38px; top: 0; width: 29px; height: 29px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); }
.body-zone { position: absolute; display: block; background: color-mix(in srgb,var(--coach) var(--heat),var(--surface-2)); border: 1px solid color-mix(in srgb,var(--coach) 32%,var(--border)); }
.body-zone.push { left: 21px; top: 34px; width: 62px; height: 44px; border-radius: 24px 24px 10px 10px; }
.body-zone.pull { left: 13px; top: 41px; width: 78px; height: 57px; border-radius: 28px 28px 15px 15px; opacity: .48; }
.body-zone.core { left: 29px; top: 79px; width: 46px; height: 58px; border-radius: 8px 8px 16px 16px; }
.body-zone.legs { left: 21px; top: 135px; width: 62px; height: 74px; border-radius: 13px 13px 24px 24px; clip-path: polygon(0 0,44% 0,49% 100%,27% 100%,20% 38%,0 100%,0 0,100% 0,100% 100%,80% 38%,73% 100%,51% 100%,56% 0); }
.heat-legend { display: grid; gap: 12px; }
.heat-legend > div { display: flex; align-items: center; gap: 9px; }
.heat-legend strong,.heat-legend small { display: block; }
.heat-legend strong { color: var(--ink); font-size: 15px; }
.heat-legend small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.heat-dot { width: 13px; height: 13px; flex: 0 0 auto; border-radius: 3px; background: color-mix(in srgb,var(--coach) var(--heat),var(--surface-2)); }
.anatomy-heatmap { min-width: 0; }
.anatomy-views { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.anatomy-views figure { min-width: 0; margin: 0; padding: 12px 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); text-align: center; }
.anatomy-views figure > div { width: min(100%,150px); margin: 0 auto; }.anatomy-views svg { display: block; width: 100%; height: 250px; overflow: visible; }
.anatomy-views figcaption { margin-top: 3px; color: var(--ink); font-size: 13px; font-weight: 780; }
.anatomy-base { fill: color-mix(in srgb,var(--muted) 9%,var(--surface)); stroke: color-mix(in srgb,var(--muted) 56%,var(--border)); stroke-width: 2; stroke-linejoin: round; }
.muscle-region { fill: color-mix(in srgb,var(--coach) var(--heat),var(--surface)); stroke: color-mix(in srgb,var(--coach) 55%,var(--border)); stroke-width: 1.2; transition: fill .25s ease; }
.muscle-region .anatomy-line { fill: none; stroke: color-mix(in srgb,var(--page) 70%,transparent); stroke-width: 1; }
.anatomy-legend { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px 8px; margin-top: 13px; }
.anatomy-legend > div { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 11px; }
.anatomy-legend i { width: 8px; height: 8px; border-radius: 2px; background: color-mix(in srgb,var(--coach) var(--heat),var(--surface)); }
.anatomy-legend span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }.anatomy-legend strong { color: var(--ink); font-size: 11px; }
.anatomy-source { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 10px; text-decoration: none; }
.body-progress-card { margin-top: 0; }.body-progress-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.body-progress-grid > div { min-height: 112px; padding: 16px; border-radius: 9px; background: var(--surface-2); }
.body-progress-grid span,.body-progress-grid strong,.body-progress-grid small { display: block; }.body-progress-grid span { color: var(--muted); font-size: 13px; }
.body-progress-grid strong { margin-top: 7px; color: var(--ink); font-size: 27px; }.body-progress-grid small { margin-top: 7px; color: var(--muted); line-height: 1.45; }
.body-method-note,.profile-reference-note { color: var(--muted); font-size: 12px; line-height: 1.55; }
.nutrition-overview { display: grid; grid-template-columns: 116px minmax(0,1fr); align-items: center; gap: 18px; min-height: 170px; }
.nutrition-ring { width: 112px; height: 112px; display: grid; place-content: center; text-align: center; border-radius: 50%;
  background: radial-gradient(circle closest-side,var(--surface) 76%,transparent 77% 99%),conic-gradient(var(--accent) var(--progress),var(--surface-2) 0); }
.nutrition-ring strong,.nutrition-ring small { display: block; }
.nutrition-ring strong { color: var(--ink); font-size: 25px; line-height: 1; }
.nutrition-ring small { margin-top: 5px; color: var(--muted); font-size: 12px; }
.nutrition-copy strong,.nutrition-copy span { display: block; }
.nutrition-copy strong { color: var(--ink); font-size: 21px; letter-spacing: -.03em; }
.nutrition-copy span { margin-top: 7px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.text-action { padding: 6px 0; border: 0; background: none; color: var(--coach); font-size: 14px; font-weight: 750; }
.week-card .row { align-items: flex-start; }
.week-strip { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 6px; }
.week-day { min-width: 0; padding: 11px 4px 9px; text-align: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.week-day.today { border-color: var(--coach); box-shadow: inset 0 0 0 1px var(--coach); }
.week-day > span,.week-day > strong { display: block; }
.week-day > span { color: var(--muted); font-size: 11px; }
.week-day > strong { margin-top: 5px; color: var(--ink); font-size: 17px; }
.day-marks { display: flex; justify-content: center; gap: 4px; min-height: 6px; margin-top: 8px; }
.day-marks i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day-marks i.move { background: var(--coach); }.day-marks i.meal { background: var(--accent); }
.quick-launch { margin-top: 22px; }
.quick-launch-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.quick-launch-grid button { min-height: 94px; padding: 16px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); }
.quick-launch-grid strong,.quick-launch-grid span { display: block; }.quick-launch-grid strong { font-size: 17px; }.quick-launch-grid span { margin-top: 7px; color: var(--muted); font-size: 13px; }

/* 루틴 중심 운동 탭 */
.workout-primary-actions { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 4px 0 12px; }
.workout-action-card { display: grid; grid-template-rows: 28px auto 1fr; min-width: 0; min-height: 132px; padding: 16px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); }
.workout-action-card > span { color: var(--coach); font-size: 22px; line-height: 1; }.workout-action-card strong { margin-top: 6px; font-size: 17px; line-height: 1.25; word-break: keep-all; }.workout-action-card small { align-self: end; margin-top: 9px; color: var(--muted); font-size: 12px; line-height: 1.35; word-break: keep-all; }
.workout-action-card.photo { border-color: color-mix(in srgb,var(--coach) 55%,var(--border)); background: color-mix(in srgb,var(--coach) 8%,var(--surface)); }
.exercise-entry-row { display: flex; gap: 7px; max-width: 100%; margin-bottom: 20px; padding: 1px 0 7px; overflow-x: auto; scrollbar-width: none; }.exercise-entry-row::-webkit-scrollbar { display: none; }
.exercise-entry-row button { flex: 0 0 auto; min-height: 40px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 720; }
.routine-finder { min-height: 278px; margin: 0 0 20px; padding: 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.routine-finder-head,.routine-catalog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }.routine-finder-head h2,.routine-catalog-heading h2 { margin: 4px 0 12px; color: var(--ink); font-size: 24px; }.routine-finder-head > span,.routine-catalog-heading > span { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 700; }
.routine-search { width: 100%; margin-bottom: 13px; }.filter-label { margin: 12px 0 6px; color: var(--muted); font-size: 12px; font-weight: 760; }
.routine-module-tray { margin: 0 0 20px; padding: 19px; border: 1px solid color-mix(in srgb,var(--coach) 55%,var(--border)); border-radius: 14px; background: color-mix(in srgb,var(--coach) 8%,var(--surface)); }
.routine-module-tray[hidden] { display: none; }.routine-module-tray h2 { margin: 4px 0 0; font-size: 22px; }.routine-module-tray p { margin: 12px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.routine-module-chips { display: flex; gap: 7px; margin-top: 14px; overflow-x: auto; scrollbar-width: none; }.routine-module-chips::-webkit-scrollbar { display: none; }.routine-module-chips span { flex: 0 0 auto; max-width: 240px; padding: 8px 11px; border-radius: 999px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 720; }
.routine-compose-start { width: 100%; min-height: 52px; }.routine-module-toggle.selected { border-color: var(--coach); color: var(--coach); background: color-mix(in srgb,var(--coach) 12%,var(--surface)); }
.routine-list { min-height: 330px; margin-bottom: 18px; }
.quick-start-routine { min-height: 220px; margin-bottom: 20px; padding: 24px; border: 1px solid color-mix(in srgb,var(--coach) 48%,var(--border)); border-radius: 14px; background: linear-gradient(145deg,color-mix(in srgb,var(--coach) 10%,var(--surface)),var(--surface)); }
.quick-start-routine h2 { margin: 5px 0 9px; color: var(--ink); font-size: clamp(25px,6vw,34px); line-height: 1.2; }
.quick-start-routine p { min-height: 48px; margin: 0 0 20px; color: var(--muted); line-height: 1.55; }
.quick-start-button { min-height: 62px; font-size: 19px; }
.quick-routine-actions { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(120px,.8fr); gap: 9px; }.quick-routine-actions .btn { width: 100%; }
.routine-catalog-heading { margin: 26px 2px 12px; }.routine-catalog-heading h2 { margin-bottom: 0; }
.routine-section-title { margin: 24px 0 12px; color: var(--ink); font-size: 20px; }
.routine-history { margin: 12px 0 20px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.routine-history summary { padding: 16px 18px; color: var(--ink); font-weight: 730; cursor: pointer; }.routine-history-list { padding: 0 18px 7px; }
.routine-top-actions { display: grid; grid-template-columns: minmax(175px,auto) 1fr; align-items: center; gap: 12px; min-height: 64px; margin-bottom: 14px; }
.routine-top-actions > span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.photo-action { background: var(--coach); color: #fff; border-color: var(--coach); }
.routine-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 16px; }
.routine-card { display: flex; flex-direction: column; min-width: 0; min-height: 218px; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.routine-card h2 { margin: 18px 0 8px; color: var(--ink); font-size: 23px; line-height: 1.2; letter-spacing: -.04em; }
.routine-card p { flex: 1; margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.routine-card.completed { opacity: .76; }.routine-card.rehab { border-color: color-mix(in srgb,var(--good) 50%,var(--border)); background: linear-gradient(155deg,color-mix(in srgb,var(--good) 7%,var(--surface)),var(--surface)); }
.routine-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 11px; }.routine-metrics span { padding: 5px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; }
.routine-reference { margin: -8px 0 14px; color: var(--coach); font-size: 12px; font-weight: 720; text-decoration: none; }.routine-reference:hover { text-decoration: underline; }
.routine-safety-tag { margin: -6px 0 14px; color: var(--good); font-size: 12px; font-weight: 760; }.routine-safety-tag.warning { color: var(--warning); }.rehab-notice { display: grid; gap: 4px; margin: 0 0 16px; padding: 12px 14px; border: 1px solid color-mix(in srgb,var(--good) 42%,var(--border)); border-radius: 10px; background: color-mix(in srgb,var(--good) 8%,var(--surface)); line-height: 1.45; }.rehab-notice strong { color: var(--good); font-size: 14px; }.rehab-notice span { color: var(--ink-2); font-size: 13px; word-break: keep-all; }.rehab-notice.acro { border-color: color-mix(in srgb,var(--warning) 45%,var(--border)); background: color-mix(in srgb,var(--warning) 8%,var(--surface)); }.rehab-notice.acro strong { color: var(--warning); }
.routine-load-more { width: 100%; min-height: 52px; margin-bottom: 18px; }.personal-routines { margin: 18px 0; }.personal-routines > summary { margin-bottom: 12px; color: var(--ink); font-size: 18px; font-weight: 760; }
.routine-source { display: inline-flex; padding: 6px 9px; border-radius: 999px; color: var(--ink); background: var(--surface-2); font-size: 12px; font-weight: 760; }
.routine-source.photo { color: var(--coach); background: color-mix(in srgb,var(--coach) 12%,var(--surface)); }
.routine-source.done { color: var(--good); background: color-mix(in srgb,var(--good) 12%,var(--surface)); }
.routine-source.coach { color: var(--accent); background: color-mix(in srgb,var(--accent) 12%,var(--surface)); }
.routine-count { color: var(--muted); font-size: 12px; font-weight: 700; }
.routine-actions { display: flex; gap: 8px; flex-wrap: wrap; }.routine-actions .btn { flex: 1 1 calc(50% - 4px); }.routine-actions .routine-module-toggle { flex-basis: 100%; }
.routine-empty p { margin-bottom: 18px; line-height: 1.6; }
.inspiration-routines h2 { margin-bottom: 2px; }
.manual-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 12px; padding: 18px 19px;
  text-align: left; border: 1px dashed var(--border); border-radius: 10px; color: var(--ink); background: var(--surface-2); }
.manual-toggle strong,.manual-toggle small { display: block; }.manual-toggle strong { font-size: 17px; }.manual-toggle small { margin-top: 4px; color: var(--muted); font-size: 13px; }
.manual-toggle > span { color: var(--coach); font-size: 14px; font-weight: 750; }
.manual-builder { padding-top: 4px; }

/* 사진 기록/루틴 분석 */
.record-actions { display: flex; gap: 9px; min-height: 58px; padding: 0 0 12px; }
.record-actions .btn { flex: 1; }
.records-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.records-head .page { margin: 0; }.record-stats-entry { flex: 0 0 auto; background: var(--coach); color: #fff; border-color: var(--coach); }
.record-stats-entry.on { background: var(--primary); border-color: var(--primary); }.records-seg { scroll-snap-type: x proximity; }.records-seg button { scroll-snap-align: start; }
.records-body { min-height: 410px; }
.record-list-item { align-items: center; flex-wrap: wrap; gap: 9px; cursor: pointer; }.record-list-item > .grow { min-width: min(190px,100%); }
.record-inline-actions { display: flex; gap: 6px; margin-left: auto; }.record-inline-actions button { min-height: 38px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 750; }
.record-inline-actions button.danger { color: var(--critical); }.workout-sets-editor { min-height: 170px; resize: vertical; font-family: inherit; line-height: 1.55; }.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
@media (max-width: 520px) { .record-inline-actions { flex: 0 0 100%; }.record-inline-actions button { flex: 1; } }
.record-kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.photo-analysis-preview { width: 100%; max-height: 32vh; object-fit: contain; border-radius: 10px; background: var(--surface-2); }
.photo-analysis-status { display: grid; gap: 10px; min-height: 150px; padding: 16px 2px 2px; }
.photo-analysis-status > strong { color: var(--ink); font-size: 20px; line-height: 1.35; }.photo-analysis-status p { margin: 0; color: var(--muted); line-height: 1.55; }
.photo-spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--coach); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.photo-record-results { display: grid; gap: 7px; }.photo-record-results > div { display: flex; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 8px; background: var(--surface-2); }
.photo-record-results b { color: var(--ink); }.photo-record-results span,.photo-warning { color: var(--muted); font-size: 12px; }.photo-warning { display: block; line-height: 1.45; }
.photo-confirm-actions { margin: 4px 0 0; }
.report-measurement > strong { flex: 0 0 auto; color: var(--ink); font-size: 17px; }.report-values-input { min-height: 132px; resize: vertical; }
.calendar-marks .report,.calendar-legend .report,.detail-icon.report { background: var(--warning); color: var(--warning); }
.workout-complete-feedback { margin: 16px 0 0; padding: 16px; border-radius: 10px; background: color-mix(in srgb,var(--good) 10%,var(--surface)); color: var(--ink); line-height: 1.6; }
.overload-note { display: flex; flex-wrap: wrap; gap: 5px 9px; align-items: center; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.4; }
.overload-note strong { color: var(--ink); }.overload-note.raised strong { color: var(--coach); }
.exercise-inline-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: stretch; gap: 14px; margin-top: 12px; }
.plan-item-actions { justify-content: stretch; margin-top: 12px; }
.exercise-inline-actions .vlink,.exercise-swap-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: var(--coach); font-size: 14px; font-weight: 750; line-height: 1.25; text-align: center; text-decoration: none; white-space: normal; }
.exercise-swap-button { width: 100%; }
.exercise-resource-actions { margin-bottom: 8px; }
.workout-weight-stepper { justify-content: center; flex-wrap: wrap; gap: 10px 14px; margin: 8px 0 2px; }.workout-weight-value { min-width: 58px; text-align: center; color: var(--ink); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.workout-weight-label { flex: 0 0 100%; color: var(--muted); font-size: 13px; font-weight: 750; text-align: center; }
.workout-protocol { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; padding: 12px 14px; border: 1px solid color-mix(in srgb,var(--coach) 32%,var(--border)); border-radius: 10px; background: color-mix(in srgb,var(--coach) 9%,var(--surface)); }.workout-protocol strong { flex: 0 0 auto; color: var(--coach); font-size: 15px; }.workout-protocol span { color: var(--ink-2); font-size: 13px; line-height: 1.4; text-align: right; }.workout-protocol.active { margin: 10px 0 2px; }
.quick-load-field { margin-top: 12px; }.quick-load-field small { display: block; margin-top: 6px; line-height: 1.4; }
.manual-session-item { align-items: end; gap: 10px; }.manual-session-name { min-width: 120px; }.manual-session-name small { display: block; margin-top: 3px; }
.manual-session-fields { display: flex; align-items: end; gap: 7px; }.manual-session-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.manual-session-fields .f { width: 68px !important; min-height: 44px; padding: 8px; text-align: center; }
@media (max-width: 520px) { .manual-session-item { align-items: start; flex-wrap: wrap; }.manual-session-name { flex: 1 0 calc(100% - 52px); }.manual-session-fields { order: 3; width: 100%; }.manual-session-fields label { flex: 1; }.manual-session-fields .f { width: 100% !important; } }
.alternative-list { display: grid; gap: 10px; min-height: 190px; }.alternative-card { display: flex; gap: 12px; align-items: center; padding: 15px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.alternative-card .grow { min-width: 0; }.alternative-card strong { color: var(--ink); font-size: 17px; }.alternative-card p { margin: 4px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }.alternative-card small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.alternative-card .btn { flex: 0 0 auto; width: auto; }
.workout-feedback-card { margin-top: 16px; padding: 17px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.workout-feedback-card.syncing { border-color: color-mix(in srgb,var(--good) 45%,var(--border)); box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--good) 12%,transparent); }
.workout-feedback-card.sync-failed { border-color: color-mix(in srgb,var(--critical) 50%,var(--border)); }
.workout-feedback-card h4 { margin: 0; color: var(--ink); font-size: 20px; }.workout-feedback-card > p { margin: 5px 0 13px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.effort-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.effort-chip { min-height: 48px; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 700; }.effort-chip.on { border-color: var(--coach); background: color-mix(in srgb,var(--coach) 12%,var(--surface)); color: var(--coach); box-shadow: inset 0 0 0 1px var(--coach); }
.workout-feedback-card textarea { width: 100%; min-height: 72px; margin: 10px 0; padding: 12px; resize: vertical; border: 1px solid var(--border); border-radius: 9px; background: var(--page); color: var(--ink); font: inherit; font-size: 15px; line-height: 1.45; }
.feedback-sync { min-height: 22px; margin: -2px 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.feedback-sync.pending { display: flex; align-items: center; gap: 7px; color: var(--good); }
.feedback-sync.pending::before { content: ''; width: 10px; height: 10px; border: 2px solid color-mix(in srgb,var(--good) 28%,transparent); border-top-color: var(--good); border-radius: 50%; animation: spin .7s linear infinite; }
.feedback-sync.saved { color: var(--good); }.feedback-sync.failed { color: var(--critical); }
.plan-guide-disclosure { width: 100%; margin-top: 10px; border-top: 1px solid var(--border); }
.plan-guide-disclosure > summary,.exercise-guide-more > summary { padding: 10px 0 2px; color: var(--coach); font-size: 14px; font-weight: 750; cursor: pointer; }
.exercise-guide { width: 100%; margin: 14px 0 4px; padding: 16px; text-align: left; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.exercise-guide-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.exercise-guide-title strong { color: var(--ink); font-size: 17px; }.exercise-guide-title span { color: var(--muted); font-size: 12px; }
.exercise-guide-summary { margin: 0 0 12px; padding: 11px 12px; border-radius: 9px; background: var(--surface-2); color: var(--ink); font-size: 15px; line-height: 1.62; word-break: keep-all; overflow-wrap: break-word; }
.exercise-guide ol { display: grid; gap: 7px; margin: 0; padding-left: 22px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.exercise-guide li { padding-left: 3px; word-break: keep-all; overflow-wrap: break-word; }
.exercise-guide-breath,.exercise-guide-caution { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 9px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--grid); font-size: 14px; line-height: 1.5; }
.exercise-guide-breath b { color: var(--coach); }.exercise-guide-caution b { color: var(--critical); }
.exercise-guide-breath span,.exercise-guide-caution span { color: var(--ink-2); word-break: keep-all; overflow-wrap: break-word; }
.exercise-guide-more p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.exercise-guide.preview { margin: 14px 0; background: var(--surface-2); }.exercise-guide.preview .exercise-guide-title { margin-bottom: 8px; }

/* 세트가 시작되면 채팅/메뉴와 분리된 고정 전체 화면 플레이어 */
body.workout-player-active { overflow: hidden; }
body.workout-player-active #appbar,body.workout-player-active #tabbar,body.workout-player-active #view { visibility: hidden; pointer-events: none; }
body.workout-player-active #modal-root .scrim { z-index: 1400; }
body.workout-player-active #modal-root .sheet { z-index: 1401; }
.workout-player-fullscreen { position: fixed; z-index: 1250; inset: 0; display: flex; flex-direction: column; width: 100vw; max-width: none; height: 100dvh; min-height: 100dvh; max-height: none; margin: 0; padding: max(30px,calc(env(safe-area-inset-top) + 18px)) max(20px,calc(env(safe-area-inset-right) + 20px)) max(30px,calc(env(safe-area-inset-bottom) + 20px)) max(20px,calc(env(safe-area-inset-left) + 20px)); overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; border: 0; border-radius: 0; background: var(--page); box-shadow: none; isolation: isolate; contain: style; }
.workout-player-fullscreen[data-phase="active"] { padding-bottom: max(166px,calc(env(safe-area-inset-bottom) + 150px)); }
.workout-player-fullscreen[data-phase="rest"],.workout-player-fullscreen[data-phase="done"] { padding-bottom: max(104px,calc(env(safe-area-inset-bottom) + 88px)); }
.workout-player-fullscreen > * { width: min(100%,680px); margin-left: auto; margin-right: auto; }
.workout-player-fullscreen > .btn,.workout-player-fullscreen > .btnrow { display: flex; }
.workout-player-fullscreen h3 { font-size: clamp(26px,7vw,42px); }.workout-player-fullscreen .bignum { font-size: clamp(76px,22vw,140px); }
.workout-time-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin: 12px auto 8px; }
.workout-time-metric { min-width: 0; padding: 10px 7px; text-align: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.workout-time-metric span,.workout-time-metric strong { display: block; }.workout-time-metric span { color: var(--muted); font-size: 11px; font-weight: 700; }.workout-time-metric strong { margin-top: 5px; color: var(--ink); font-size: clamp(15px,4vw,20px); line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.protocol-timing-hero { position: sticky; z-index: 12; top: max(0px,env(safe-area-inset-top)); width: min(100%,680px); margin: 0 auto 14px; padding: 14px 16px 15px; overflow: hidden; border: 1px solid color-mix(in srgb,var(--coach) 62%,var(--border)); border-radius: 16px; color: var(--ink); background: color-mix(in srgb,var(--coach) 12%,var(--surface)); box-shadow: 0 8px 26px color-mix(in srgb,var(--page) 70%,transparent); transition: background-color .2s ease,border-color .2s ease,transform .16s ease; }
.protocol-timing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.protocol-timing-head > strong { color: var(--coach); font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }.protocol-timing-head > span { color: var(--ink-2); font-size: 13px; font-weight: 750; }
.protocol-timing-primary { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 12px; margin-top: 7px; }.protocol-timing-primary > span { padding-bottom: 8px; color: var(--ink-2); font-size: 14px; font-weight: 760; }.protocol-timing-primary > strong { color: var(--ink); font-size: clamp(54px,15vw,86px); line-height: .92; letter-spacing: -.065em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.protocol-timing-bar { height: 7px; margin-top: 11px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb,var(--ink) 10%,transparent); }.protocol-timing-bar > div { width: 100%; height: 100%; border-radius: inherit; background: var(--coach); transition: width .25s linear,background-color .2s ease; }
.protocol-timing-hero > small { display: block; margin-top: 8px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.protocol-timing-hero.tabata.active { border-color: color-mix(in srgb,var(--accent) 72%,var(--border)); background: color-mix(in srgb,var(--accent) 15%,var(--surface)); }.protocol-timing-hero.tabata.active .protocol-timing-head > strong,.protocol-timing-hero.tabata.active .protocol-timing-bar > div { color: var(--accent); background: var(--accent); }
.protocol-timing-hero.rest { border-color: color-mix(in srgb,var(--coach) 48%,var(--border)); background: color-mix(in srgb,var(--coach) 8%,var(--surface)); }.protocol-timing-hero.rest .protocol-timing-primary > strong { color: var(--coach); }
.protocol-timing-hero.critical { animation: protocol-clock-pulse .72s ease-in-out infinite alternate; }.protocol-timing-hero.critical .protocol-timing-primary > strong { color: var(--danger,#d83a2e); }
@keyframes protocol-clock-pulse { from { transform: scale(1); } to { transform: scale(1.012); } }
@media (prefers-reduced-motion:reduce) { .protocol-timing-hero.critical { animation: none; } }
.workout-player-fullscreen .videobox { flex: 0 0 auto; width: min(100%,640px); max-height: min(38dvh,360px); border-radius: 12px; }
.workout-player-fullscreen .exercise-guide { flex: 0 0 auto; }
.workout-player-controls { position: fixed; z-index: 20; left: max(12px,env(safe-area-inset-left)); right: max(12px,env(safe-area-inset-right)); bottom: max(12px,env(safe-area-inset-bottom)); width: auto; max-width: 680px; margin: 0 auto; padding: 10px; border: 1px solid var(--border); border-radius: 15px; background: var(--surface); box-shadow: 0 -10px 30px color-mix(in srgb,var(--page) 72%,transparent),var(--shadow); }
.workout-player-controls .workout-complete-set { width: 100%; min-height: 58px; padding: 14px; font-size: 18px; }.workout-player-controls .btnrow { margin-top: 8px; }.workout-player-controls .btnrow .btn { min-height: 44px; }
.workout-player-controls.compact { padding: 9px; }.workout-player-controls.compact > .btn { width: 100%; min-height: 54px; margin: 0; font-size: 17px; }
.workout-player-exit { width: 100%; margin: 0; }

/* 운동·식사 캘린더 */
.calendar-card { padding: 14px; overflow: hidden; }
.calendar-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 13px; }
.calendar-head h2 { margin: 0; text-align: center; font-size: 22px; }
.calendar-head button { width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 50%; background: var(--surface-2); color: var(--ink); font-size: 27px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 5px; }
.calendar-weekday { padding: 7px 0; text-align: center; color: var(--muted); font-size: 12px; font-weight: 750; }
.calendar-day { position: relative; min-width: 0; min-height: 82px; padding: 9px 5px 7px; text-align: left; border: 1px solid transparent; border-radius: 8px; background: var(--surface-2); color: var(--ink); }
.calendar-day.blank { visibility: hidden; }.calendar-day.logged { border-color: var(--border); background: var(--surface); }.calendar-day.today { border-color: var(--coach); box-shadow: inset 0 0 0 1px var(--coach); }
.calendar-day strong { display: block; font-size: 15px; }.calendar-day small { display: block; overflow: hidden; margin-top: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.calendar-marks { display: flex; gap: 4px; min-height: 7px; margin-top: 9px; }.calendar-marks i,.calendar-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.calendar-marks .move,.calendar-legend .move,.detail-icon.move { background: var(--coach); color: var(--coach); }.calendar-marks .meal,.calendar-legend .meal,.detail-icon.meal { background: var(--accent); color: var(--accent); }
.calendar-marks .body,.calendar-legend .body,.detail-icon.body { background: var(--good); color: var(--good); }
.calendar-legend { display: flex; justify-content: center; gap: 17px; margin: -3px 0 18px; color: var(--muted); font-size: 12px; }.calendar-legend span { display: flex; align-items: center; gap: 5px; }
.calendar-day-detail { display: grid; gap: 4px; margin-bottom: 18px; }.calendar-day-detail > div { display: grid; grid-template-columns: 15px 1fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.calendar-day-detail strong { color: var(--ink); font-size: 16px; }.calendar-day-detail p { margin: 4px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }.detail-icon { margin-top: 6px; font-size: 9px; }

@media (hover: none) {
  .message-actions { opacity: .72; }
}
@media (pointer: coarse) {
  body:has(input:focus,textarea:focus,select:focus,[contenteditable="true"]:focus) { --active-tabbar-h: 0px; }
  body:has(input:focus,textarea:focus,select:focus,[contenteditable="true"]:focus) #tabbar {
    transform: translate3d(0,110%,0); opacity: 0; visibility: hidden; pointer-events: none;
  }
}
@media (max-width: 520px) {
  html, body { scrollbar-gutter: auto; }
  body[data-page="coach"], #view[data-page="coach"] { width: 100%; max-width: 100%; }
  .tiles { gap: 10px; }
  #view { padding-left: 16px; padding-right: 16px; }
  #view[data-page="coach"] { padding-left: 0; padding-right: 0; }
  #chat-scroll { padding-left: 16px; padding-right: 16px; }
  .prompt-grid { grid-template-columns: 1fr; }
  .composer-hint { display: none; }
  #chat-input-bar { padding-bottom: 5px; }
  body.keyboard-open #chat-input-bar { padding-bottom: 8px; }
  .message-row { max-width: 94%; }
  .message-row.assistant { width: 94%; }
  .coach-context-chip { margin-left: 0; margin-right: 0; }
  .briefing-grid { grid-template-columns: 1fr; gap: 0; }
  .home-skeleton .briefing-grid { gap: 16px; }
  .home-insight-skeleton { min-height: 390px; }
  .body-heatmap { grid-template-columns: 118px minmax(0,1fr); gap: 10px; }
  .anatomy-views svg { height: 225px; }
  .nutrition-overview { grid-template-columns: 105px minmax(0,1fr); gap: 14px; }
  .nutrition-ring { width: 102px; height: 102px; }
  .week-card { padding-left: 12px; padding-right: 12px; }
  .week-day { padding-left: 2px; padding-right: 2px; }
  .quick-launch-grid { grid-template-columns: 1fr; }
  .quick-launch-grid button { min-height: 76px; }
  .routine-list { min-height: 360px; height: auto; overflow: visible; }
  .workout-primary-actions { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .workout-action-card { min-height: 124px; padding: 14px; }.workout-action-card strong { font-size: 16px; }.workout-action-card small { font-size: 11px; }
  .routine-finder { min-height: 290px; padding: 16px 14px; margin-left: 0; margin-right: 0; }.routine-finder .chips { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }.routine-finder .chip { flex: 0 0 auto; }
  .quick-start-routine { min-height: 0; padding: 19px 17px; }.quick-start-routine h2 { font-size: 27px; }.quick-start-routine p { min-height: 0; }
  .quick-routine-actions { grid-template-columns: 1fr; }.quick-start-button { min-height: 58px; }
  .routine-grid { grid-template-columns: 1fr; }
  .routine-card { min-height: 204px; }
  .routine-top-actions { grid-template-columns: 1fr; gap: 7px; }.routine-top-actions > span { padding: 0 2px; }
  .routine-actions { flex-wrap: wrap; }.routine-actions .btn { flex-basis: calc(50% - 4px); }
  .body-progress-grid { grid-template-columns: 1fr; }
  .calendar-card { margin-left: -5px; margin-right: -5px; padding: 9px 7px 12px; }
  .calendar-grid { gap: 3px; }
  .calendar-day { min-height: 67px; padding: 7px 3px 5px; }
  .calendar-day small { display: none; }
  .workout-set-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .profile-form-card { gap: 15px; padding: 18px 16px; }
  .profile-reference-grid { grid-template-columns: 1fr; gap: 14px; }
  .profile-choice-chip { min-height: 40px; padding: 8px 12px; font-size: 13px; }
  .locale-seg { grid-auto-columns: minmax(94px,1fr); }
}
@media (max-width: 360px) {
  #chat-input-bar { padding-left: 6px; padding-right: 6px; }
  #chat-input-bar .iconbtn { width: 32px; height: 32px; }
  #chat-input-bar .iconbtn.send { width: 34px; height: 34px; }
  #chat-text { min-height: 36px; padding-left: 9px; padding-right: 9px; }
}

/* ── 구독·결제 페이지 ─────────────────────────────────────────── */
.plan-badge{display:inline-flex;align-items:center;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:800;letter-spacing:.02em}
.plan-badge.free{background:color-mix(in srgb,var(--ink) 8%,transparent);color:var(--muted)}
.plan-badge.pro{background:var(--accent);color:#fff}
.billing-plan-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.billing-plan-meta{display:flex;flex-direction:column;gap:4px;margin:10px 0 14px}
.billing-cancel-note{font-size:12.5px;color:var(--accent);margin-top:8px}
.usage-meter{margin:12px 0}
.usage-meter-head{display:flex;justify-content:space-between;font-size:13.5px;margin-bottom:6px}
.usage-meter-bar{height:8px;border-radius:999px;background:color-mix(in srgb,var(--ink) 8%,transparent);overflow:hidden}
.usage-meter-fill{height:100%;border-radius:999px;background:var(--coach);transition:width .3s}
.usage-meter-fill.warn{background:#d98a00}
.usage-meter-fill.full{background:var(--error,#b8352b)}
.plan-compare{list-style:none;padding:0;margin:10px 0 16px;display:flex;flex-direction:column;gap:8px;font-size:14px}
.plan-buttons{display:flex;flex-direction:column;gap:8px}
.plan-buttons .btn.primary{background:var(--ink);color:var(--page)}
.invoice-list{display:flex;flex-direction:column}
.invoice-row{align-items:center}
.invoice-links{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
.invoice-links .btn.sm{text-decoration:none}
.sub.small{font-size:12.5px;color:var(--muted)}
