/* Layout: one narrow phone column — recap card, calendar, then the selected day's sets; picker is a bottom sheet.
   Category colors borrow competition plate colors (25 red, 20 blue, 15 yellow, 10 green). */
:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --ink: #16181D;
  --muted: #6A6F7C;
  --line: #E1E3E8;
  --soft: #EAECF0;
  --accent: #CF2A2A;
  --accent-ink: #FFFFFF;
  --c-chest: #CF2A2A;
  --c-back: #2456C2;
  --c-legs: #D99A00;
  --c-shoulder: #1E9652;
  --c-arms: #7B5BE6;
  --c-core: #DB6A1E;
  --c-cardio: #0D93A0;
  --c-pilates: #B8368A;
  --star: #E0A100;
  --text-mix: 100%;
  --stamp: #D33A2F;
  --today-bg: #FFD9B3; --today-ink: #8A4300;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --f-num: "Barlow Condensed", "Arial Narrow", "IBM Plex Sans KR", sans-serif;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #374151; --surface: #4B5563; --ink: #F8FAFC; --muted: #CBD5E1; --line: #5F6978; --soft: #56606F;
    --accent: #FF6464; --accent-ink: #FFFFFF; --stamp: #FF7A6E; --today-bg: #FFC894; --today-ink: #5C2D00;
    --c-chest: #FF6464; --c-back: #7FA6FF; --c-legs: #FFC63A; --c-shoulder: #4CD48C; --c-arms: #B6A4FF; --c-core: #FF9B55; --c-cardio: #45D3DF; --c-pilates: #F08AD2;
    --star: #FFC63A; --text-mix: 60%; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #374151; --surface: #4B5563; --ink: #F8FAFC; --muted: #CBD5E1; --line: #5F6978; --soft: #56606F;
  --accent: #FF6464; --accent-ink: #FFFFFF;
  --c-chest: #FF6464; --c-back: #7FA6FF; --c-legs: #FFC63A; --c-shoulder: #4CD48C; --c-arms: #B6A4FF; --c-core: #FF9B55; --c-cardio: #45D3DF; --c-pilates: #F08AD2;
  --star: #FFC63A; --text-mix: 60%; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 560px; margin: 0 auto; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); padding-block: 10px 32px; display: flex; flex-direction: column; gap: 10px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-family: var(--f-num); font-weight: 700; font-size: 26px; letter-spacing: .01em; line-height: 1; display: flex; align-items: center; gap: 8px; }
.brand i { display: inline-block; width: 10px; height: 22px; border-radius: 3px; background: var(--accent); }
.brand small { font-family: var(--f-body); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.top-r { display: flex; align-items: center; gap: 12px; }
.top-link { font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.top-link:hover { color: var(--ink); }
a.brand { color: inherit; text-decoration: none; } /* 로고를 누르면 홈(기록)으로 */
/* 헤더 아래 메뉴 줄(오른쪽 정렬): '홈 · 마이페이지 · 관리자' 글자 링크. 현재 페이지는 진하게 */
.pnav { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: -6px; font-size: 13px; font-weight: 600; }
.pnav a { color: var(--muted); text-decoration: none; }
.pnav a:hover { color: var(--ink); }
.pnav a[aria-current="page"] { color: var(--ink); }
.pnav i { font-style: normal; color: var(--muted); opacity: .6; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.seg button { padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

/* ---- 캐릭터 카드 ---- */
.hero { background: var(--surface); border-radius: var(--r); padding: 10px 12px; display: flex; align-items: center; gap: 12px; position: relative; }
.hero:empty { display: none; }
.avatar { position: relative; aspect-ratio: 420 / 500; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.hero .avatar { width: 80px; flex: none; background: radial-gradient(70% 60% at 50% 40%, color-mix(in srgb, var(--soft) 60%, var(--surface)), var(--soft)); border-radius: 14px; }
.hero-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero-info .stage { font-size: 16px; font-weight: 700; }
.hero-info .stage b { font-family: var(--f-num); font-size: 20px; color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); margin-right: 4px; }
.hero-info .sub { font-size: 12px; color: var(--muted); }
.hero-info .sub b { color: var(--ink); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.stamp { display: inline-flex; align-items: center; font-family: var(--f-num); font-weight: 700; font-size: 13px; letter-spacing: .02em; color: var(--stamp); border: 2px solid var(--stamp); border-radius: 6px; padding: 1px 7px; transform: rotate(-3deg); background: color-mix(in srgb, var(--stamp) 8%, transparent); }
.stamp.off { color: var(--muted); border-color: var(--line); background: none; transform: none; font-family: var(--f-body); font-weight: 600; font-size: 12px; }
.hero-av { flex: none; border-radius: 14px; }
.hero-av:active .avatar { transform: scale(.96); }
.hero-edit { position: absolute; top: 8px; right: 10px; font-size: 12px; font-weight: 700; color: var(--ink); background: var(--soft); padding: 4px 10px; border-radius: 999px; }
.hero-edit:hover { background: var(--line); }
.hero-make { display: flex; align-items: center; gap: 12px; width: 100%; }
.hero-make .avatar { width: 64px; opacity: .5; filter: grayscale(1); }
.hero-make > div { flex: 1; min-width: 0; }
.hero-make strong { display: block; font-size: 15px; }
.hero-make small { font-size: 12px; color: var(--muted); }
.hero-btn { height: 36px; padding: 0 14px; border-radius: 9px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 13px; white-space: nowrap; }
@media (prefers-reduced-motion: no-preference) {
  .avatar img { animation: av-breathe 2.6s ease-in-out infinite; transform-origin: 50% 100%; }
  .avatar img:nth-child(n+5) { animation-delay: .12s; } /* 티셔츠·머리는 살짝 늦게 따라와 숨 쉬는 느낌 */
  @keyframes av-breathe { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(.6%) scaleY(.99); } }
  .hero.levelup .avatar { animation: av-jump .6s ease-out 2; }
  @keyframes av-jump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px) scale(1.06); } }
}

.av-panel { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); gap: 14px; overflow-y: auto; }
.av-panel h2 { margin: 0; font-size: 17px; flex: 1; }
.av-preview { display: flex; justify-content: center; background: var(--surface); border-radius: var(--r); padding: 10px; }
.av-preview .avatar { width: 160px; }
.av-opts { display: flex; flex-direction: column; gap: 10px; }
.av-row { display: flex; flex-direction: column; gap: 6px; }
.av-row > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.av-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.av-chip { height: 34px; padding: 0 12px; border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--muted); border: 2px solid transparent; }
.av-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.av-chip.sw { width: 34px; padding: 0; background: var(--sw); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.av-chip.sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }

.recap { background: var(--surface); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.recap .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.recap .cats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.recap .title { font-size: 16px; font-weight: 700; }
.recap ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.recap li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.recap li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap li .v { font-family: var(--f-num); font-size: 15px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.recap li .v small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.recap .since { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.recap .since b { font-weight: 600; }
.recap .empty { color: var(--muted); font-size: 14px; }

/* 친구 현황: 가로로 늘어선 캐릭터, 누르면 아래에 마지막 운동이 펼쳐진다 */
.friends { background: var(--surface); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.friends .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; display: flex; justify-content: space-between; gap: 8px; }
.friends .cnt { font-weight: 500; }
.friends .cnt b { color: var(--ink); }
.friends .empty { color: var(--muted); font-size: 14px; }
.friends .empty a { font-weight: 600; color: var(--ink); white-space: nowrap; }
.friend-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -8px; padding: 0 8px; }
.friend-row::-webkit-scrollbar { display: none; }
.friend { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; border-radius: 12px; }
.friend .avatar { width: 46px; border-radius: 12px; background: radial-gradient(70% 60% at 50% 40%, color-mix(in srgb, var(--soft) 60%, var(--surface)), var(--soft)); }
.friend .avatar.ghost { opacity: .5; filter: grayscale(1); }
.friend b { font-size: 12px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend .st { font-size: 11px; color: var(--muted); white-space: nowrap; }
.friend.on .st { color: var(--stamp); font-weight: 700; }
.friend.on .avatar { box-shadow: 0 0 0 2px var(--stamp); }
.friend.sel { background: var(--soft); }
.friend-detail { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.fd-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.fd-head span { font-size: 12px; color: var(--muted); }
.fd-title { font-size: 12px; font-weight: 600; color: var(--muted); }
.friend-detail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.friend-detail li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.friend-detail li span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-detail li .v { font-family: var(--f-num); font-size: 15px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
.friend-detail li .v small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); line-height: 1.2; }
.friend-detail .empty { color: var(--muted); font-size: 14px; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 7px; border-radius: 999px; background: var(--soft); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cc, var(--muted)); }

.cal { background: var(--surface); border-radius: var(--r); padding: 8px 8px 10px; }
.cal-head { display: flex; align-items: center; gap: 4px; padding: 0 2px 6px; }
.cal-head h2 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; text-align: center; font-variant-numeric: tabular-nums; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.today-btn { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.dow { text-align: center; font-size: 11px; color: var(--muted); padding: 1px 0 3px; }
.dow.sun { color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); }
.day { position: relative; border-radius: 10px; min-height: 44px; padding: 5px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.day:hover { background: var(--soft); }
.day .num { position: relative; z-index: 1; font-family: var(--f-num); font-size: 16px; font-weight: 600; width: 25px; height: 25px; line-height: 25px; text-align: center; border-radius: 50%; font-variant-numeric: tabular-nums; }
.day.out .num { color: var(--muted); opacity: .5; }
.day.today .num { background: var(--today-bg); color: var(--today-ink); }
.day.sel { box-shadow: inset 0 0 0 2px var(--ink); }
/* 오운완 도장: 날짜 둘레에 살짝 기울어진 붉은 인주 링. 한쪽 잉크가 옅어 도장처럼 보이게 */
.day.done .num { font-weight: 700; }
/* 오운완 도장(stamp.png, 불꽃 윤곽 160×162)을 날짜 숫자 위에 80% 로 겹쳐 찍는다. 불꽃 속 빈 공간(세로 69% 지점)이 숫자 중심에 오도록 위로 올림 */
.day.done::before { content: ""; position: absolute; top: -5px; left: 50%; width: 34px; aspect-ratio: 160 / 162; translate: -50% 0; background: var(--stamp-img) center / contain no-repeat; opacity: .8; z-index: 2; pointer-events: none; }
.day.done.out::before { opacity: .3; }
.dots { display: flex; gap: 3px; height: 6px; position: relative; z-index: 1; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--cc); }
.week .day { min-height: 92px; justify-content: flex-start; }
.week .tags { position: relative; z-index: 1; }
.week .tags { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.week .tags span { font-size: 11px; font-weight: 600; color: color-mix(in srgb, var(--cc) var(--text-mix), var(--ink)); line-height: 1.25; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px; font-size: 11px; color: var(--muted); padding-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 4px; }
.legend span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cc); }

.day-panel { display: flex; flex-direction: column; gap: 8px; }
/* 제목 줄은 스크롤해도 화면 위에 붙어 있어서, 운동이 많아져도 '운동 추가'를 바로 누를 수 있다 */
.day-head { display: flex; align-items: center; gap: 8px; padding: 4px 2px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 2; background: var(--bg); }
.day-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.day-head .tag { font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); }
.day-head .tag.saved { color: var(--muted); }
.day-r { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.head-add { font-size: 13px; font-weight: 700; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 7px 12px; white-space: nowrap; }
.head-add:active { background: var(--soft); }
.day-head h2 { white-space: nowrap; }
@media (max-width: 359px) { .day-head .tag.editing { display: none; } } /* 좁은 화면에선 제목 줄이 두 줄로 꺾이지 않게 */
.day-empty { color: var(--muted); font-size: 14px; padding: 4px 2px; }
/* 운동 시간 줄: 타이머(오늘) 또는 분 직접 입력(편집 중) */
.day-time { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: var(--r); padding: 6px 12px; font-size: 14px; color: var(--muted); min-height: 44px; }
.day-time > b { font-family: var(--f-num); font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.day-time .field.min { width: 110px; height: 36px; flex: none; }
.day-time .field.min input { font-size: 19px; }
.day-time.run { color: var(--ink); }
.day-time.run #tm { font-family: var(--f-num); font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-left: 4px; }
.tm-btn { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--ink); background: var(--soft); border-radius: 999px; padding: 7px 12px; white-space: nowrap; }
.tm-btn.stop { background: var(--accent); color: var(--accent-ink); }
.ex-sum { font-family: var(--f-num); font-size: 13px; font-weight: 600; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ex-sum:empty { display: none; }
.recap .sum { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.recap .sum b { font-family: var(--f-num); font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
/* 지난 기록 가져오기 (빈 날에만) */
.copy { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.copy .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; padding: 0 2px; }
.copy-row { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; align-items: baseline; text-align: left; width: 100%; background: var(--surface); border-radius: var(--r); padding: 8px 12px; box-shadow: inset 0 0 0 1px var(--line); }
.copy-row:active { background: var(--soft); }
.copy-row .d { font-weight: 700; font-size: 14px; white-space: nowrap; }
.copy-row .cats { font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-row .exs { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex { background: var(--surface); border-radius: var(--r); padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 6px; }
.ex-head { display: flex; align-items: flex-start; gap: 8px; }
.ex-name { flex: 1; min-width: 0; }
.ex-name strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.3; }
.ex-name small { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.ex-del { font-size: 12px; color: var(--muted); padding: 4px 6px; border-radius: 6px; white-space: nowrap; }
.ex-del.arm { color: var(--accent-ink); background: var(--accent); }
.sets { display: flex; flex-direction: column; gap: 5px; }
.set { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 8px; align-items: center; }
.set.one { grid-template-columns: 24px minmax(0, 1fr) 30px; }
.set .n { font-family: var(--f-num); font-size: 15px; font-weight: 600; color: var(--muted); text-align: center; }
.field { display: flex; align-items: center; background: var(--soft); border-radius: 8px; padding: 0 10px; height: 40px; min-width: 0; }
.field input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; font-family: var(--f-num); font-size: 20px; font-weight: 600; text-align: right; padding: 0 6px 0 0; font-variant-numeric: tabular-nums; }
.field input:focus { outline: none; }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.field span { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* 잠긴 기록: 입력칸 대신 값만 */
.ex.locked .field { background: color-mix(in srgb, var(--soft) 45%, transparent); }
.field b { flex: 1; font-family: var(--f-num); font-size: 20px; font-weight: 600; text-align: right; padding-right: 6px; font-variant-numeric: tabular-nums; }
.field b.empty { color: var(--muted); font-weight: 400; }
.set-del { width: 30px; height: 30px; border-radius: 50%; color: var(--muted); font-size: 18px; line-height: 1; }
.set-del:hover { background: var(--soft); }
.set-add { align-self: flex-start; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 4px; }
.set-add:hover { color: var(--ink); }
.add-btn { height: 44px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15px; }
.add-btn:disabled { opacity: .4; cursor: default; }
.add-btn.sec { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.day-actions { display: flex; gap: 8px; }
.day-actions .add-btn { flex: 1; }
.foot { font-size: 12px; color: var(--muted); text-align: center; }

.sheet { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; justify-content: flex-end; background: rgb(0 0 0 / .4); }
.sheet-panel { background: var(--bg); border-radius: 16px 16px 0 0; width: 100%; max-width: 560px; margin: 0 auto; max-height: 90%; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.sheet-top { padding: 12px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.sheet-row { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; height: 42px; border-radius: 10px; border: 0; background: var(--surface); padding: 0 12px; font-size: 16px; min-width: 0; }
.close { font-size: 14px; font-weight: 600; color: var(--muted); padding: 8px 4px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
.chips::-webkit-scrollbar { display: none; }
/* 마우스 환경은 가로 스크롤 대신 줄바꿈 (스크롤바를 숨겨 두어 휠로는 옆으로 못 넘기므로) */
@media (hover: hover) and (pointer: fine) { .chips { flex-wrap: wrap; overflow: visible; } .sheet-top { flex: none; max-height: 45vh; overflow-y: auto; } }
.f { flex: none; font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.f[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.f.sm { font-size: 12px; padding: 3px 10px; background: transparent; border: 1px solid var(--line); }
.f.sm[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.list { overflow-y: auto; padding: 6px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); -webkit-overflow-scrolling: touch; }
.row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.row .star { width: 40px; height: 48px; font-size: 20px; color: var(--line); flex: none; }
.row .star[aria-pressed="true"] { color: var(--star); }
.row .pick { flex: 1; min-width: 0; text-align: left; padding: 9px 0; display: flex; align-items: center; gap: 8px; }
.row .pick > div { flex: 1; min-width: 0; }
.row .pick strong { display: block; font-weight: 600; font-size: 15px; }
.row .pick small { display: block; font-size: 12px; color: var(--muted); }
.row .pick em { font-style: normal; font-family: var(--f-num); font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.row .pick .cdot { width: 8px; height: 8px; border-radius: 50%; background: var(--cc); flex: none; }
.no-res { color: var(--muted); font-size: 14px; padding: 16px 4px 8px; }
.custom { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.custom p { margin: 0; font-size: 13px; color: var(--muted); }
.custom .sheet-row input, .custom select { height: 40px; border-radius: 10px; border: 0; background: var(--surface); padding: 0 10px; font-size: 16px; min-width: 0; }
.custom input { flex: 1; }
.custom button { height: 40px; padding: 0 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .day.new::before { animation: stamp-in .4s cubic-bezier(.2, 1.4, .4, 1) both; }
  @keyframes stamp-in { from { transform: scale(1.8); opacity: 0; } to { transform: none; opacity: .8; } }
  .sheet-panel { animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}

/* ---- 당겨서 새로고침: 최상단에서 아래로 끌면 화살표가 내려오고, 충분히 당긴 뒤 놓으면 다시 불러온다 ---- */
.ptr { position: fixed; top: env(safe-area-inset-top, 0px); left: 50%; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: 0 2px 8px rgb(0 0 0 / .14); display: flex; align-items: center; justify-content: center; z-index: 15; pointer-events: none; transform: translate(-50%, -48px); transition: transform .22s ease-out, color .15s; }
.ptr.pull { transition: color .15s; }
.ptr.ready { color: var(--accent); }
.ptr.busy svg { display: none; }
.ptr.busy::after { content: ''; width: 16px; height: 16px; border: 2.4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* ---- standalone page basics ---- */
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg); overscroll-behavior-y: contain; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }

.foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 14px; margin: 0; }
.foot button, .foot a { font-size: 12px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.foot span { font-weight: 600; color: var(--ink); }

.pw-form, .sheet-form { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.pw-form h2, .sheet-form h2 { margin: 0; font-size: 17px; flex: 1; }
.pw-form label, .sheet-form > label, .row2 label, .auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pw-form input, .sheet-form input:not([type="radio"]):not([type="checkbox"]), .auth-form input { height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); padding: 0 12px; font-size: 16px; color: var(--ink); font-weight: 400; }
.pw-form input:focus, .sheet-form input:focus, .auth-form input:focus { outline: none; border-color: var(--ink); }
.sheet-form .field-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: -6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-row { display: flex; flex-direction: column; gap: 6px; }
.radio { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--ink); }
.radio input { accent-color: var(--ink); margin: 0; }
.radio span { display: flex; flex-direction: column; gap: 1px; }
.radio b { font-size: 14px; }
.radio small { font-size: 12px; color: var(--muted); }
.ch-members { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-members .empty { color: var(--muted); font-size: 13px; margin: 0; }
.chk { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; cursor: pointer; }
.chk:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chk input { display: none; }

/* 그룹 도전 카드 */
.chal { background: var(--surface); border-radius: var(--r); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.chal .label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; display: flex; justify-content: space-between; align-items: center; }
.chal .empty { color: var(--muted); font-size: 14px; }
.ch-new { font-size: 12px; font-weight: 700; color: var(--ink); background: var(--soft); padding: 5px 10px; border-radius: 999px; }
.ch-card { display: flex; flex-direction: column; gap: 7px; padding: 12px; border-radius: 12px; background: var(--bg); }
.ch-card.met { background: color-mix(in srgb, var(--c-shoulder) 10%, var(--bg)); }
.ch-card.ended:not(.met) { opacity: .75; }
.ch-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ch-head strong { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-when { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ch-goal { font-size: 12px; color: var(--muted); margin-top: -4px; }
.ch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ch-row .n { width: 64px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ch-row.me .n { color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); }
.ch-row .n small { display: block; font-size: 10px; font-weight: 500; color: var(--muted); line-height: 1.1; }
.ch-row .v { width: 40px; flex: none; text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; color: var(--muted); }
.ch-row .v b, .ch-row b { color: var(--ink); font-family: var(--f-num); font-size: 15px; }
.ch-row .ch-who { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.bar { flex: 1; height: 8px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: var(--ink); transition: width .3s; }
.bar.met i { background: var(--c-shoulder); }
.ch-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 2px; }
.ch-status { font-size: 13px; font-weight: 700; }
.ch-card.met .ch-status { color: var(--c-shoulder); }
.ch-leave { font-size: 12px; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.chal .label.sub { margin-top: 4px; }
.ch-card.invite { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.ch-card.invite .ch-status { color: var(--muted); font-weight: 600; }
.ch-join { font-size: 13px; font-weight: 700; color: var(--bg); background: var(--ink); padding: 7px 14px; border-radius: 999px; }
.ch-join:disabled { opacity: .5; }
.ch-leave.arm { color: var(--accent-ink); background: var(--accent); }

/* ---- auth pages ---- */
.auth { display: flex; justify-content: center; }
.auth-box { width: 100%; max-width: 400px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); padding-block: 12vh 40px; display: flex; flex-direction: column; gap: 14px; }
.auth-box h1 { margin: 10px 0 0; font-size: 22px; }
.auth-box .sub { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form small { font-weight: 400; font-size: 12px; }
.auth-form button { height: 50px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: 700; font-size: 16px; margin-top: 4px; }
.auth-alt { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.auth-alt a { color: var(--ink); font-weight: 600; }
.error, .notice { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.error { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: color-mix(in srgb, var(--accent) var(--text-mix), var(--ink)); }
.notice { background: color-mix(in srgb, var(--c-shoulder) 14%, var(--surface)); color: var(--ink); }

/* 주소 이전 안내 팝업 (moved.js, CANONICAL_URL 이 설정됐을 때만) */
.moved { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgb(0 0 0 / .45); }
.moved-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 20px 18px 14px; width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 12px 40px rgb(0 0 0 / .25); }
.moved-box h2 { margin: 0; font-size: 18px; }
.moved-box p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.5; }
.moved-box .moved-url { font-weight: 700; color: var(--ink); font-size: 16px; word-break: break-all; font-variant-numeric: tabular-nums; }
.moved-box .moved-sub { font-size: 12px; }
.moved-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.moved-go { display: grid; place-items: center; height: 46px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15px; text-decoration: none; }
.moved-later { height: 40px; color: var(--muted); font-weight: 600; font-size: 13px; }
