/* 아라엑스짐 운동 — 유산소 루틴 플레이어 (routine.js) 화면
   모든 클래스는 .rt- 로 시작해요. 색은 index.html :root 토큰만 써서 밝은/어두운 모드가 저절로 맞아요.
   구간 색: easy = --good · walk = --good 진하게 · run = --o · fast = --o-deep · climb = --gold · steady = --o-2
   움직임 '적게'(html[data-motion="less"]): 코치 통통·기울기·색 물결·확대 효과를 끄고 색 테두리만 남겨요. */

.rt { --mc: var(--good); --mc-t: var(--paper); padding: 4px 16px 0; color: var(--ink); }
.stage .rt, .rt.flush { padding-left: 0; padding-right: 0; }
.rt-m-easy { --mc: var(--good); }
.rt-m-walk { --mc: var(--good); }
.rt-m-run { --mc: var(--o); }
.rt-m-fast { --mc: var(--o-deep); }
.rt-m-climb { --mc: var(--gold); }
.rt-m-steady { --mc: var(--o-2); }
@supports (color: color-mix(in srgb, red 50%, blue)) {
  .rt-m-walk { --mc: color-mix(in srgb, var(--good) 72%, var(--ink)); }
  .rt-cur, .rt-next { --mc-t: color-mix(in srgb, var(--mc) 16%, var(--paper)); }
}
.rt h2, .rt p { margin: 0; }
.rt .num { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.rt-small { font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.rt-card { padding: 16px; border-radius: 20px; background: var(--paper); border: 2px solid var(--line); display: grid; gap: 6px; }

/* ---------- 코스 그래프 ---------- */
.rt-g { position: relative; border-radius: 18px; overflow: hidden; background: var(--paper); border: 2px solid var(--line); isolation: isolate; }
.rt-gbg { position: absolute; inset: -10px; z-index: 0; background: center 60% / cover no-repeat; filter: blur(3px); opacity: .3; pointer-events: none; }
.rt-gbg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 55%, transparent), color-mix(in srgb, var(--bg) 20%, transparent)); }
:root[data-theme="dark"] .rt-gbg { opacity: .14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rt-gbg { opacity: .14; } }
.rt-gsvg { position: relative; z-index: 1; }
.rt-gsvg svg { display: block; overflow: visible; }
.rt-svg text { font-family: var(--f-num); font-weight: 800; paint-order: stroke; stroke-width: 3px; stroke-linejoin: round; }
.rt-svg .rt-gv { font-size: 10.5px; }
.rt-svg .rt-gl { font-size: 10.5px; font-family: var(--f); }
.rt-svg .rt-gt { font-size: 9.5px; font-weight: 700; stroke: none; }
.rt-g.small { padding: 6px 8px; }
.rt-g.paused .rt-gsvg { opacity: .45; }
/* 코치(마스코트 동그란 얼굴 34px): 1초마다 지금 시각 자리로 미끄러져 가요 */
.rt-coach { position: absolute; left: 0; top: 0; z-index: 3; width: 34px; height: 34px; transition: transform 1s linear; will-change: transform; pointer-events: none; }
.rt-face { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--o-tint) center 8% / 160% auto no-repeat; border: 2px solid var(--o); box-shadow: 0 2px 6px rgba(0, 0, 0, .2); animation: rt-bob 1200ms var(--e-sine, ease-in-out) infinite; transition: rotate 300ms var(--e-std, ease); }
.rt-face.up { rotate: -14deg; }
.rt-face.dn { rotate: 9deg; }
.rt-g.paused .rt-face { animation-play-state: paused; }
@keyframes rt-bob { 50% { transform: translateY(-3px); } }
.rt-bub { position: absolute; left: 0; top: 0; z-index: 5; max-width: 150px; width: max-content; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 13px; line-height: 1.35; border-radius: 12px; padding: 6px 10px; pointer-events: none; }
.rt-pband { position: absolute; left: 50%; top: 50%; z-index: 4; transform: translate(-50%, -50%); background: var(--ink); color: var(--bg); font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 999px; white-space: nowrap; }
.rt-vbtn { position: absolute; right: 6px; top: 6px; z-index: 4; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.rt-vbtn svg { width: 20px; height: 20px; }
.rt-vbtn[aria-pressed="false"] { color: var(--muted); }

/* ---------- 시작 전 ---------- */
.rt-rd { display: grid; gap: 12px; padding-bottom: 8px; }
.rt-h { font-size: 22px; font-weight: 900; line-height: 1.3; letter-spacing: -.01em; }
.rt-h:focus { outline: none; }
.rt-h:focus-visible { outline: 3px solid var(--o); outline-offset: 2px; }
.rt-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; color: var(--muted); font-weight: 700; font-size: 14px; }
.rt-chip { background: var(--chip); color: var(--on-chip); font-weight: 900; font-size: 12px; border-radius: 999px; padding: 3px 10px; }
.rt-note { display: flex; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--o-tint); color: var(--o-ink); font-weight: 700; font-size: 14px; line-height: 1.5; }
.rt-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.rt-glegend { margin: -4px 2px 0; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.5; }
.rt-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13.5px; font-weight: 700; }
.rt-legend b { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.rt-tk { display: inline-flex; align-items: center; gap: 6px; }
/* 숨 단계 막대 세 칸 */
.rt-tm { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; flex: none; }
.rt-tm b { display: block; width: 4px; border-radius: 2px; background: var(--line); }
.rt-tm b:nth-child(1) { height: 6px; } .rt-tm b:nth-child(2) { height: 10px; } .rt-tm b:nth-child(3) { height: 14px; }
.rt-tm.m1 b:nth-child(1), .rt-tm.m2 b:nth-child(-n+2), .rt-tm.m3 b { background: var(--o-ink); }
.rt-safe { list-style: none; margin: 0; padding: 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--paper); display: grid; gap: 8px; font-size: 14px; line-height: 1.55; }
.rt-safe li { display: flex; gap: 8px; }
.rt-safe li:not(.w) { padding-left: 26px; position: relative; }
.rt-safe li:not(.w)::before { content: ""; position: absolute; left: 8px; top: .7em; width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }
.rt-safe li.w { font-weight: 800; color: var(--o-ink); }
.rt-safe svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--o); }
.rt-vrow { display: flex; }
.rt-voice { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper); color: var(--muted); font-weight: 800; font-size: 14px; cursor: pointer; }
.rt-voice[aria-checked="true"] { border-color: var(--o); color: var(--o-ink); }
.rt-voice svg { width: 20px; height: 20px; flex: none; }

/* ---------- 하는 중 ---------- */
.rt-run { display: grid; gap: 10px; }
.rt-run .rt-g { height: 154px; }
.rt-cur { position: relative; display: grid; gap: 6px; padding: 14px; border-radius: 20px; background: var(--paper); border: 2px solid var(--mc); transition: border-color 300ms var(--e-std, ease); }
.rt-ch { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding-right: 72px; min-height: 36px; }
.rt-lab { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 9px; border-radius: 999px; background: var(--mc-t); border: 1px solid var(--mc); font-weight: 900; font-size: 18px; line-height: 1.2; }
.rt-lab i { width: 12px; height: 12px; border-radius: 50%; background: var(--mc); flex: none; }
.rt-talk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--muted); line-height: 1.35; }
.rt-mv { position: absolute; right: 12px; top: 12px; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--media-bg); border: 1px solid var(--line); }
.rt-mv video, .rt-mv img { display: block; width: 100%; height: 100%; object-fit: cover; filter: var(--media-dim); }
.rt-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 18px; min-height: 60px; }
.rt-n { display: inline-flex; align-items: baseline; gap: 4px; }
.rt-n small { font-family: var(--f); font-size: 13px; font-weight: 800; color: var(--muted); }
.rt-n b { display: inline-block; font-size: clamp(44px, 14vw, 64px); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.rt-n em { font-family: var(--f); font-style: normal; font-size: 14px; font-weight: 700; color: var(--muted); }
.rt-rpm { flex-basis: 100%; font-family: var(--f); font-size: 13px; font-weight: 700; color: var(--muted); }
.rt-left { justify-self: start; font-size: clamp(52px, 18vw, 80px); font-weight: 900; line-height: 1; letter-spacing: -.02em; transform-origin: 0 60%; }
.rt-bar { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.rt-bar i { display: block; height: 100%; background: var(--mc); transform-origin: 0 50%; transform: scaleX(0); transition: transform 200ms linear; }
.rt-cal { display: grid; gap: 8px; padding: 12px; border-radius: 16px; border: 2px dashed var(--o); background: var(--o-tint); font-size: 15px; }
.rt-cal b { color: var(--o-ink); }
.rt-calb { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rt-calb .btn { min-height: 48px; }
.rt-next { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--mc-t); border: 1px solid var(--line); font-weight: 800; font-size: 15px; line-height: 1.35; transition: border-color 200ms var(--e-std, ease), box-shadow 200ms var(--e-std, ease); }
.rt-next i { width: 10px; height: 10px; border-radius: 50%; background: var(--mc); flex: none; }
.rt-next.soon { border-color: var(--mc); box-shadow: inset 0 0 0 1px var(--mc); }
.rt-tot { text-align: center; color: var(--muted); font-weight: 800; font-size: 14px; }
.rt-btns { position: sticky; bottom: 0; z-index: 15; display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; padding: 12px 0 calc(env(safe-area-inset-bottom, 0px) + 6px); background: linear-gradient(transparent, var(--bg) 24%); }
.rt-btns .btn { min-height: 56px; }
.rt-endb { grid-column: 1 / -1; justify-self: center; min-height: 44px; padding: 8px 18px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rt-go { min-height: 56px; }

/* 구간이 바뀔 때 화면 가장자리 색 물결 */
.rt-wave { position: fixed; inset: 0; z-index: 74; pointer-events: none; opacity: 0; box-shadow: inset 0 0 0 6px var(--mc), inset 0 0 48px 8px var(--mc); }
/* 3·2·1 */
.rt-cd { position: fixed; inset: 0; z-index: 75; display: grid; place-items: center; background: rgba(20, 18, 16, .35); pointer-events: none; }
@supports (color: color-mix(in srgb, red 50%, blue)) { .rt-cd { background: color-mix(in srgb, var(--bg) 72%, transparent); } }
.rt-cd b { font-family: var(--f-num); font-size: 128px; font-weight: 900; color: var(--o); line-height: 1; }

/* ---------- 숨 질문 ---------- */
.rt-br { display: grid; gap: 12px; padding-bottom: 12px; }
.rt-brh { display: grid; justify-items: center; gap: 2px; }
.rt-brh img { width: 112px; height: 112px; object-fit: contain; }
.rt-br .rt-h { text-align: center; }
.rt-bropts { display: grid; gap: 12px; }
.rt-bo { --dep: 4px; --bd: var(--line); display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 14px; border-radius: 18px; text-align: left; cursor: pointer; }
.rt-bo .rt-tm { height: 22px; gap: 3px; } .rt-bo .rt-tm b { width: 6px; } .rt-bo .rt-tm b:nth-child(1) { height: 9px; } .rt-bo .rt-tm b:nth-child(2) { height: 15px; } .rt-bo .rt-tm b:nth-child(3) { height: 22px; }
.rt-bo b { display: block; font-size: 17px; font-weight: 900; }
.rt-bo small { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.rt-unk { justify-self: center; min-height: 44px; padding: 8px 18px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rt-dn { display: grid; gap: 12px; justify-items: center; padding: 28px 0; font-weight: 800; }

/* ---------- 끝내기 창 · 알림 ---------- */
.rt-dlg { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); background: rgba(20, 18, 16, .45); }
.rt-dlgc { width: 100%; max-width: 448px; margin: 0 auto; display: grid; gap: 10px; padding: 18px; border-radius: 22px; background: var(--bg); border: 2px solid var(--line); box-shadow: var(--shadow); }
.rt-dlgc p { margin: 0 0 4px; font-size: 17px; font-weight: 800; line-height: 1.45; }
.rt-toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 14px); z-index: 85; transform: translateX(-50%); max-width: calc(100vw - 32px); width: max-content; padding: 9px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 800; font-size: 14px; line-height: 1.4; text-align: center; }

/* 움직임 '적게': 통통·기울기·미끄러짐·물결 끔 (색 테두리만) */
html[data-motion="less"] .rt-face { animation: none; rotate: none; transition: none; }
html[data-motion="less"] .rt-coach, html[data-motion="less"] .rt-bar i, html[data-motion="less"] .rt-cur, html[data-motion="less"] .rt-next { transition: none; }
html[data-motion="less"] .rt-wave { display: none; }
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) .rt-face { animation: none; rotate: none; }
  html:not([data-motion="full"]) .rt-coach { transition: none; }
}
