:root {
  --bg: #10142c;
  --glass: rgba(18, 24, 50, 0.58);
  --glass-strong: rgba(18, 24, 50, 0.86);
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f2ea;
  --muted: #b9bdd2;
  --accent: #ffc27a;
  --accent-ink: #2a1c0c;
  --track: #e07a5f;
  --radius: 999px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; font-size: 14px; letter-spacing: -0.01em; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* ---------- 시작 화면 ---------- */
.boot { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; text-align: center;
  background: radial-gradient(120% 80% at 50% 110%, #5b4879 0%, #1b2452 45%, #0a0e24 100%); transition: opacity .7s ease; }
.boot.is-leaving { opacity: 0; pointer-events: none; }
.boot-mark { color: var(--accent); margin-bottom: 4px; }
.boot-mark svg { width: 40px; height: 40px; stroke-width: 1.3; }
.boot h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: 6px; padding-left: 6px; }
.boot-sub { margin: 0; color: var(--muted); font-size: 14px; }
.boot-msg { margin: 18px 0 0; color: #9aa0bf; font-size: 12px; min-height: 18px; }
.boot-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: breathe 1.8s ease-in-out infinite; }
.boot-hint { margin: 2px 0 0; color: #8a90ae; font-size: 12px; }
.boot-retry { position: absolute; bottom: max(24px, var(--safe-b)); color: var(--muted); font-size: 13px; text-underline-offset: 3px; visibility: hidden; padding: 12px; }
.boot.is-slow .boot-retry, .boot.is-error .boot-retry { visibility: visible; }
.boot.is-error .boot-dot { display: none; }
@keyframes breathe { 50% { opacity: .25; } }

.btn-primary { margin-top: 10px; min-height: 48px; padding: 0 26px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; box-shadow: 0 8px 30px rgba(255, 180, 100, .25); }
.btn-primary:active { transform: scale(.98); }
.btn-line { min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.06); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- 상단 ---------- */
.top { position: fixed; z-index: 10; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; pointer-events: none; }
.pill { pointer-events: auto; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pill.place { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; color: var(--text); min-width: 0; }
.pill.place svg { width: 17px; height: 17px; color: var(--accent); }
.pill.tools { padding: 0 4px 0 12px; gap: 0; }
.tools .count { display: flex; align-items: center; gap: 4px; padding-right: 6px; color: var(--muted); font-size: 13px; }
.tools .count svg { width: 17px; height: 17px; }
.tools .count b { color: var(--text); font-weight: 700; }
.tools button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 50%; }
.tools button:hover { background: rgba(255,255,255,.08); }
#btn-sound .off { display: none; }
#btn-sound.is-muted .on { display: none; }
#btn-sound.is-muted .off { display: inline; }
#btn-music.is-playing { color: var(--accent); }

/* ---------- 이름표 ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.nametag { position: absolute; left: 0; top: 0; display: none; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: var(--radius); background: rgba(255,255,255,.88); color: #2a2d3c; font-size: 12px; font-weight: 600; white-space: nowrap; will-change: transform; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.nametag b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--track); color: #fff; font-size: 11px; }
.nametag.on { display: flex; }

/* ---------- 달리기 기록 ---------- */
.runhud { position: fixed; z-index: 10; top: calc(62px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; gap: 2px; padding: 10px 8px; border-radius: 20px; background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.runhud > div { min-width: 92px; padding: 0 10px; text-align: center; }
.runhud > div + div { border-left: 1px solid var(--line); }
.runhud small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.runhud strong { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.runhud em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 2px; }

/* ---------- 하단 ---------- */
.bar { position: fixed; z-index: 10; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: calc(100vw - 24px); }
.bar-row { display: flex; align-items: center; gap: 6px; padding: 6px; border-radius: 26px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.bar-run { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 72px; min-height: 56px; padding: 6px 12px; border: 0; border-radius: 20px; background: none; font-size: 12px; font-weight: 600; }
.act:hover { background: rgba(255,255,255,.08); }
.act:active { transform: scale(.97); }
.act.main { background: var(--accent); color: var(--accent-ink); min-width: 104px; }
.act.main:hover { background: #ffcf95; }
.act.main.near { background: var(--track); color: #fff; animation: pulse 2s ease-in-out infinite; }
.act.sm { min-width: 52px; }
.act.sm svg { width: 24px; height: 24px; }
.act.stop { flex-direction: row; gap: 6px; min-width: 120px; min-height: 48px; background: rgba(255,255,255,.1); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(224,122,95,.25); } }

.seg { display: flex; padding: 4px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.seg button { min-width: 76px; min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--radius); background: none; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg.small button { min-width: 0; flex: 1; min-height: 36px; }

/* ---------- 알림 ---------- */
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translate(-50%, 10px); max-width: calc(100vw - 32px); padding: 11px 18px; border-radius: 16px; background: rgba(250,247,240,.95); color: #262838; font-size: 13px; font-weight: 600; line-height: 1.5; text-align: center; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; box-shadow: 0 6px 24px rgba(0,0,0,.3); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
body.running .toast { bottom: calc(262px + var(--safe-b)); }

/* ---------- 시트 ---------- */
.sheet { position: fixed; z-index: 40; right: 12px; top: calc(62px + var(--safe-t)); width: 340px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 90px - var(--safe-t)); overflow-y: auto; padding: 16px 18px 20px; border-radius: 22px; background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: 0 16px 48px rgba(0,0,0,.4); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sheet h2 { margin: 0; font-size: 17px; }
.sheet h3 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sheet .muted { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.x { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.06); color: var(--text); font: inherit; }
.slider { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; min-height: 36px; font-size: 13px; }
.slider input { width: 100%; accent-color: var(--accent); }
.player { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.player button { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); }
.player #m-play .pause { display: none; }
.player #m-play.is-playing .play { display: none; }
.player #m-play.is-playing .pause { display: inline; }
.player .now { flex: 1; min-width: 0; margin: 0 0 0 8px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist { list-style: none; margin: 10px 0 0; padding: 0; max-height: 160px; overflow-y: auto; }
.playlist li button { width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 10px; background: none; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.playlist li button:hover { background: rgba(255,255,255,.06); }
.playlist li.on button { color: var(--accent); font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; box-shadow: inset 0 0 0 2px rgba(0,0,0,.15); }
.swatches button.on { border-color: var(--text); }
.records { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.records li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.records li span:first-child { color: var(--muted); }
.records .empty { color: var(--muted); justify-content: center; border: 0; }
.help { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.help summary { cursor: pointer; font-weight: 600; color: var(--text); font-size: 13px; }
.help p { margin: 8px 0 0; }

/* ---------- 결과 ---------- */
.modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: rgba(6, 8, 20, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.card { width: 360px; max-width: 100%; padding: 26px 22px 20px; border-radius: 26px; background: #f7f3ea; color: #24263a; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.eyebrow { margin: 0; color: #a0674a; font-size: 12px; font-weight: 700; }
.card h2 { margin: 6px 0 18px; font-size: 22px; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 20px; }
.sum-grid div { padding: 12px; border-radius: 16px; background: #ece6d9; }
.sum-grid dt { font-size: 11px; color: #74705f; }
.sum-grid dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-actions { display: flex; flex-direction: column; gap: 8px; }
.card-actions .btn-primary { margin: 0; }
.card .btn-line { color: #3b3d50; border-color: #d8d1c2; background: none; min-height: 46px; }

@media (max-width: 520px) {
  .pill.place { padding: 0 12px; }
  .tools button { width: 36px; }
  .runhud > div { min-width: 0; flex: 1; padding: 0 8px; }
  .runhud { left: 12px; right: 12px; transform: none; }
  .runhud strong { font-size: 21px; }
  .act { min-width: 64px; padding: 6px 8px; }
  .act.main { min-width: 96px; }
  .seg button { min-width: 68px; }
  .sheet { left: 12px; right: 12px; width: auto; top: auto; bottom: calc(12px + var(--safe-b)); max-height: 72dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .boot-dot, .act.main.near { animation: none; }
  .toast, .boot { transition: none; }
}

/* ================= 2단계 추가 ================= */
.fade { position: fixed; inset: 0; z-index: 48; background: #0a0e24; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.fade.on { opacity: 1; }
.place-ch { color: var(--muted); font-weight: 500; }
.net-dot { width: 7px; height: 7px; border-radius: 50%; background: #8a90ae; flex: none; }
.net-dot.on { background: #6ee7a8; box-shadow: 0 0 0 3px rgba(110,231,168,.18); }
.boot-course { margin-top: 14px; color: var(--muted); font-size: 13px; }
.boot-course b { color: var(--text); }

/* 라벨: 이름표 · 말풍선 */
.tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column-reverse; align-items: center; gap: 4px; white-space: nowrap; will-change: transform; pointer-events: none; }
.tag .nm { display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 3px; border-radius: var(--radius); background: rgba(255,255,255,.88); color: #2a2d3c; font-size: 12px; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.tag .nm i { display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #8a90ae; color: #fff; font-size: 10px; font-style: normal; font-weight: 700; }
.tag.me .nm i { background: var(--track); }
.tag.pacer .nm { padding: 3px 10px; }
.tag.far .nm { opacity: .75; }
.tag .bub { max-width: 220px; padding: 7px 12px; border-radius: 14px 14px 14px 4px; background: #fff; color: #222433; font-size: 13px; font-weight: 600; white-space: normal; line-height: 1.4; box-shadow: 0 4px 16px rgba(0,0,0,.3); animation: pop .25s ease; }
.tag .bub.crew { background: var(--accent); color: var(--accent-ink); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }

/* 달리기 HUD */
.runhud { flex-wrap: wrap; justify-content: center; }
.r-next { flex-basis: 100%; margin: 6px 0 0; text-align: center; color: var(--muted); font-size: 12px; min-height: 16px; }
.r-next:empty { display: none; }

/* 배너 (다리 통과, 오늘의 한강 등) */
.banner { position: fixed; z-index: 30; left: 50%; top: calc(150px + var(--safe-t)); transform: translate(-50%, -8px); display: flex; flex-direction: column; align-items: center; gap: 2px; max-width: calc(100vw - 32px); padding: 12px 22px; border-radius: 18px; background: rgba(12,16,36,.78); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .4s, transform .4s; }
.banner.on { opacity: 1; transform: translate(-50%, 0); }
.banner b { font-size: 17px; }
.banner span { color: var(--muted); font-size: 13px; }
.banner span:empty { display: none; }

/* 하단 러닝 조작 */
.chip { min-height: 38px; padding: 0 16px; border: 1px solid rgba(255,255,255,.25); border-radius: var(--radius); background: rgba(12,16,36,.8); font-weight: 700; font-size: 13px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.pace-ctl { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pace-ctl button { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); }
.pace-ctl button:active { transform: scale(.94); }
.pace-val { min-width: 120px; text-align: center; }
.pace-val small { display: block; font-size: 10px; color: var(--muted); }
.pace-val strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.act.sm span { font-size: 11px; }
#b-turn, #b-cheer2 { min-width: 58px; }

/* 채팅 */
.chat { position: fixed; z-index: 12; left: 12px; bottom: calc(16px + var(--safe-b)); width: 300px; max-width: calc(100vw - 24px); display: flex; flex-direction: column; border-radius: 18px; background: rgba(12,16,36,.62); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); overflow: hidden; }
.chat-tabs { display: flex; align-items: center; gap: 2px; padding: 6px 6px 0; }
.chat-tabs button { min-height: 30px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.chat-tabs button.on { color: var(--text); background: rgba(255,255,255,.08); }
.chat-toggle { margin-left: auto; width: 30px; padding: 0 !important; display: grid; place-items: center; }
.chat.min .chat-log, .chat.min .chat-form { display: none; }
.chat.min .chat-toggle svg { transform: rotate(180deg); }
.chat-log { list-style: none; margin: 0; padding: 6px 12px; height: 150px; overflow-y: auto; font-size: 13px; line-height: 1.5; }
.chat-log li { margin: 2px 0; word-break: break-all; }
.chat-log li b { margin-right: 6px; font-weight: 700; }
.chat-log li.sys { color: var(--muted); font-size: 12px; }
.chat-log li .crew-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.chat-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.06); color: var(--text); font: inherit; }
.chat-form button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.chat-open { position: fixed; z-index: 12; left: 12px; bottom: calc(16px + var(--safe-b)); width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.chat-open i { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: #ff6b6b; }

/* 시트 공통 추가 */
.seg.wrap { flex-wrap: wrap; border-radius: 16px; }
.seg.small button.on { background: var(--accent); color: var(--accent-ink); }
.check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.btn-line.wide { width: 100%; margin-top: 12px; }
.btn-line.dark { color: #3b3d50; border-color: #d8d1c2; background: none; }
.link-btn { margin-top: 16px; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; }
.course-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.course { padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.course.on { border-color: var(--accent); }
.course b { font-size: 15px; }
.course p { margin: 2px 0 8px; color: var(--muted); font-size: 12px; }
.course .chs { display: flex; gap: 6px; flex-wrap: wrap; }
.course .chs button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: none; font-size: 12px; font-weight: 600; }
.course .chs button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.course .chs button:disabled { opacity: .4; cursor: not-allowed; }
.swatches.small button { width: 28px; height: 28px; }
.crew-card { display: flex; align-items: center; gap: 12px; padding: 12px; margin: 8px 0 10px; border-radius: 16px; background: rgba(255,255,255,.06); }
.crew-card b { display: block; font-size: 16px; }
.crew-card small { color: var(--muted); font-size: 12px; }
.crew-flag { width: 36px; height: 36px; border-radius: 12px; flex: none; }
.members { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.members li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.members li .dot { width: 8px; height: 8px; border-radius: 50%; background: #5a5f78; flex: none; }
.members li .dot.on { background: #6ee7a8; }
.members li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.members li .km { color: var(--muted); font-variant-numeric: tabular-nums; }
.members li button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: none; font-size: 11px; font-weight: 600; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.stat-row div { padding: 10px; border-radius: 14px; background: rgba(255,255,255,.06); text-align: center; }
.stat-row small { display: block; color: var(--muted); font-size: 11px; }
.stat-row b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-row em { font-style: normal; color: var(--muted); font-size: 11px; margin-left: 2px; }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.badges li { padding: 6px 10px; border-radius: var(--radius); background: rgba(255,255,255,.06); color: var(--muted); font-size: 12px; font-weight: 600; }
.badges li.got { background: rgba(255,194,122,.18); color: var(--accent); }
.badges.new { justify-content: center; margin: 0 0 14px; }
.badges.new li { background: #ffe2bd; color: #6a3d12; }
.badges.new:empty { display: none; }
.splits { list-style: none; margin: -6px 0 14px; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.splits li { padding: 4px 9px; border-radius: 10px; background: #ece6d9; color: #4b4a40; }
.splits li.best { background: #ffd7a6; color: #5a3410; font-weight: 700; }
.splits:empty { display: none; }
.card-share { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-bottom: 8px; }
.card { max-height: calc(100dvh - 32px); overflow-y: auto; }

@media (max-width: 520px) {
  .chat { left: 8px; right: 8px; width: auto; bottom: calc(8px + var(--safe-b)); }
  .chat-log { height: 120px; }
  body.running .chat-open, body.running .chat { display: none !important; }
  .bar { bottom: calc(12px + var(--safe-b)); }
  .pace-val { min-width: 96px; }
  .act.sm { min-width: 46px; padding: 6px 4px; }
  #b-turn, #b-cheer2 { min-width: 50px; }
  .act.stop { min-width: 92px; }
  .banner { top: calc(168px + var(--safe-t)); }
  .place-ch { display: none; }
}
@media (min-width: 521px) {
  .chat-open { display: none !important; }
}

/* 크루 음성 채팅 */
#btn-mic[hidden] { display: none; }
#btn-mic { color: #6ee7a8; }
#btn-mic .off { display: none; }
#btn-mic.is-muted { color: #ff8a80; }
#btn-mic.is-muted .off { display: inline; }
#btn-mic.talking { background: rgba(110,231,168,.18); }
.voice-box { margin: 14px 0 6px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,.04); }
.voice-box.live { border-color: rgba(110,231,168,.55); background: rgba(110,231,168,.06); }
.voice-head { display: flex; align-items: center; gap: 10px; }
.voice-head b { display: block; font-size: 14px; }
.voice-head small { color: var(--muted); font-size: 12px; }
.voice-ico { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.08); }
.voice-box.live .voice-ico { background: #6ee7a8; color: #10251a; }
.voice-box .row .btn-line { flex: 1; margin-top: 12px; }
.voice-box .row .btn-line.wide { margin-top: 12px; }
#voice-mute.is-muted { border-color: #ff8a80; color: #ff8a80; }
.voice-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.voice-list:empty { display: none; }
.voice-list li { display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 10px 0 6px; border-radius: var(--radius); background: rgba(255,255,255,.07); font-size: 12px; font-weight: 600; max-width: 100%; }
.voice-list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-list li i { width: 16px; height: 16px; flex: none; border-radius: 50%; background: #5a5f78; transition: box-shadow .12s; }
.voice-list li.ok i { background: #6ee7a8; }
.voice-list li.wait i { background: #ffd166; }
.voice-list li.fail i { background: #ff6b6b; }
.voice-list li.talk i { box-shadow: 0 0 0 3px rgba(110,231,168,.35); }
.voice-list li.muted i { background: #8a90ae; }
.voice-list li small { color: var(--muted); font-weight: 500; }
.tag .nm .mic { display: none; width: 18px; height: 18px; border-radius: 50%; background: #6ee7a8; flex: none; }
.tag .nm .mic svg { width: 12px; height: 12px; margin: 3px; stroke: #10251a; stroke-width: 2.4; fill: none; }
.tag.talk .nm .mic { display: block; animation: talk 0.6s ease-in-out infinite alternate; }
.tag.talk .nm { box-shadow: 0 0 0 2px #6ee7a8, 0 2px 10px rgba(0,0,0,.25); }
@keyframes talk { from { transform: scale(.9); } to { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .tag.talk .nm .mic { animation: none; } }
/* 모바일 상단: 코스 이름 짧게 */
@media (max-width: 520px) { .pn-sfx { display: none; } }
