:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1b1d22;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #ff5a1f;
  --accent-ink: #ffffff;
  --accent-soft: #fff1ea;
  --danger: #d92d20;
  --hero: #16181d;
  --radius: 14px;
  --c-video: #e0edff;   --c-video-ink: #1d4ed8;
  --c-routine: #ffeede; --c-routine-ink: #c2410c;
  --c-diet: #e3f7e8;    --c-diet-ink: #15803d;
  --c-notice: #f1ecff;  --c-notice-ink: #6d28d9;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --accent-soft: #3a2116;
    --hero: #0a0b0e;
    --c-video: #1b2a45;   --c-video-ink: #93b8ff;
    --c-routine: #3a2416; --c-routine-ink: #ffb07a;
    --c-diet: #17321f;    --c-diet-ink: #7ddc98;
    --c-notice: #2a2142;  --c-notice-ink: #c4b0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  line-height: 1.6;
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }
.wrap.narrow { max-width: 680px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.block { display: block; }
.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); padding: 8px 12px; border-radius: 8px; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.brand { font-weight: 800; letter-spacing: -.02em; color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
/* 로고 (GY PT STUDIO): 위쪽 막대는 낮게, 로그인 화면은 크게 */
.brand .logo { display: block; height: 44px; width: auto; }
.hero .brand .logo { height: 56px; }
.brand-auth { flex-direction: column; gap: 6px; width: 100%; }
.brand-auth .logo { height: 110px; }
.admin-badge { font-size: .75rem; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: #1f2937; color: #fde68a; }
.brand-sub { font-size: .8rem; font-weight: 700; color: var(--muted); }

/* ---------- 버튼/폼 ---------- */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.05); border-color: var(--accent); }
.btn-danger { color: var(--danger); }
.btn-small { padding: 4px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; padding: 0; opacity: .8; }

label { display: block; font-size: .9rem; font-weight: 600; }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-weight: 400;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="file"] { padding: 8px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.stack { display: grid; gap: 14px; }
.grid-form { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.grid-form .full { grid-column: 1 / -1; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }

.flash {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 10;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem;
  max-width: calc(100% - 32px); animation: fade 4s forwards;
}
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* ---------- 로그인 ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 24px; }
.auth-card .brand { margin-bottom: 8px; }
.auth-card p.muted { margin-top: 0; }

/* ---------- 회원 페이지 ---------- */
.hero { background: var(--hero); color: #fff; padding: 20px 0 0; margin-bottom: 20px; }
.hero .wrap { padding-bottom: 0; }
.hero-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.hero h1 { font-size: 1.6rem; margin-bottom: 4px; }
.hero-sub { margin: 0; opacity: .7; }
.preview-bar { background: var(--accent); color: #fff; text-align: center; padding: 8px 16px; font-size: .9rem; }
.preview-bar a { margin-left: 8px; font-weight: 700; white-space: nowrap; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.tabs a {
  flex: none; text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: .9rem;
}
.tabs a small { color: var(--muted); font-weight: 400; margin-left: 2px; }
.tabs a.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs a.active small { color: inherit; opacity: .7; }

.feed { display: grid; gap: 16px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.post-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.post-head time { margin-left: auto; color: var(--muted); font-size: .8rem; }
.post-title { font-size: 1.15rem; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chip { font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.chip-video   { background: var(--c-video);   color: var(--c-video-ink); }
.chip-routine { background: var(--c-routine); color: var(--c-routine-ink); }
.chip-diet    { background: var(--c-diet);    color: var(--c-diet-ink); }
.chip-notice  { background: var(--c-notice);  color: var(--c-notice-ink); }
.chip-new     { background: #e5484d; color: #fff; }
.chip-member  { background: #fef3c7; color: #92400e; }
.write-diet   { min-height: 56px; font-size: 1.1rem; margin-bottom: 16px; display: flex; align-items: center; justify-content: center; }
.post-actions-mine .btn { min-height: 48px; }
.nav-dot { top: -6px; right: -10px; }
.diet-form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.diet-form-actions .btn-primary { min-height: 56px; min-width: 160px; font-size: 1.1rem; }

/* 새 피드: 탭 숫자 오른쪽 위 빨간 점 */
.tab-count, .dot-wrap { position: relative; }
.tab-count:has(.new-dot) { margin-right: 6px; }
.new-dot {
  position: absolute; top: -9px; right: -13px; width: 12px; height: 12px; border-radius: 50%;
  background: #e5484d; box-shadow: 0 0 0 2px var(--surface);
}
.tabs a.active .new-dot { box-shadow: 0 0 0 2px var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.video { position: relative; aspect-ratio: 16 / 9; margin: 8px 0 12px; border-radius: 10px; overflow: hidden; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media { display: block; width: 100%; max-height: 520px; object-fit: contain; background: #000; border-radius: 10px; margin: 8px 0 12px; }
.ext-link { color: var(--accent); font-weight: 600; }

/* ---------- 트레이너 ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.topbar-right { display: flex; gap: 12px; align-items: center; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin: 8px 0 16px; }
.page-head h1 { margin: 0; }
.section-title { margin-top: 8px; }


.two-col { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } .two-col aside { order: -1; } }

/* ---------- 공통 ---------- */
@media (max-width: 640px) { .hide-sm { display: none; } }
.danger-text { color: var(--danger); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; }

/* ---------- 회원 화면 ---------- */
.hero-nav { display: flex; gap: 4px; margin-top: 20px; }
.hero-nav a { padding: 10px 14px; text-decoration: none; font-weight: 600; color: rgba(255, 255, 255, .65); border-bottom: 3px solid transparent; }
.hero-nav a.active { color: #fff; border-color: var(--accent); }
.hero-nav .new-dot { top: -4px; right: -12px; box-shadow: 0 0 0 2px var(--hero); }
.next-class { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; text-decoration: none; }
.next-class:hover { border-color: var(--accent); }
.next-label { font-size: .78rem; font-weight: 700; color: var(--accent); }
.next-go { margin-left: auto; font-size: .85rem; color: var(--muted); }

.sched-list { list-style: none; padding: 0; margin: 0 0 8px; }
.sched-day { font-weight: 700; padding: 14px 0 4px; }
.sched-day:first-child { padding-top: 0; }
.sched-day.is-today { color: var(--accent); }
.sched-day em { font-style: normal; font-size: .7rem; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.sched-item { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sched-item:last-child { border-bottom: 0; }

/* ---------- 트레이너 화면 ---------- */
.topbar-inner { gap: 16px; }
.topbar-nav { display: flex; gap: 4px; margin-right: auto; }
.topbar-nav a { padding: 6px 12px; border-radius: 8px; text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--muted); }
.topbar-nav a.active { background: var(--bg); color: var(--text); }
@media (max-width: 640px) { .topbar-inner { flex-wrap: wrap; } .topbar-nav { order: 3; width: 100%; } }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.member-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.member-id h1 { margin: 0; font-size: 1.35rem; }
.filter select { margin: 0; width: auto; padding: 8px 12px; }

.new-post summary { cursor: pointer; list-style: none; }
.new-post summary::-webkit-details-marker { display: none; }
.new-post summary h2 { margin: 0; color: var(--accent); }
.new-post[open] summary { margin-bottom: 16px; }

/* 공개 대상 선택 */
.recipients-field { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; background: var(--bg); }
.recipients-field legend { font-size: .9rem; font-weight: 600; padding: 0 4px; }
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-weight: 600; cursor: pointer; }
.pick input { width: auto; margin: 0; accent-color: var(--accent); }
.pick:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.post-actions { flex-wrap: wrap; justify-content: space-between; align-items: center; }
.recipients { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.person { font-size: .8rem; font-weight: 600; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.post-buttons { display: flex; gap: 8px; }

.member-list { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 8px; }
.member-list a { display: flex; gap: 14px; align-items: center; padding: 14px 16px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.member-list a:hover { border-color: var(--accent); }
.member-info { flex: 1; min-width: 0; }
.form-end { display: flex; align-items: flex-end; }

/* 일정표 (월간 달력) */
.wrap.wide { max-width: 1240px; }
:root {
  --mc0: #ff5a1f; --mc1: #2563eb; --mc2: #16a34a; --mc3: #9333ea;
  --mc4: #db2777; --mc5: #0891b2; --mc6: #ca8a04; --mc7: #4b5563;
  --sun: #dc2626; --sat: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --mc0: #ff7a45; --mc1: #6b9bff; --mc2: #4ade80; --mc3: #c084fc;
    --mc4: #f472b6; --mc5: #22d3ee; --mc6: #facc15; --mc7: #9ca3af;
    --sun: #f87171; --sat: #6b9bff;
  }
}
.mc-0 { --mc: var(--mc0); } .mc-1 { --mc: var(--mc1); } .mc-2 { --mc: var(--mc2); } .mc-3 { --mc: var(--mc3); }
.mc-4 { --mc: var(--mc4); } .mc-5 { --mc: var(--mc5); } .mc-6 { --mc: var(--mc6); } .mc-7 { --mc: var(--mc7); }

.cal-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 960px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-card { padding: 16px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-head h2 { margin: 0; font-size: 1.2rem; min-width: 7.5em; text-align: center; }
.cal-nav { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); text-decoration: none; font-size: 1.3rem; line-height: 1; }
.cal-nav:hover { border-color: var(--accent); color: var(--accent); }
.cal-today { margin-left: auto; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-wd { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 6px 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); }
.cal-wd.sun { color: var(--sun); } .cal-wd.sat { color: var(--sat); }
.cal-day {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 104px; padding: 6px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-decoration: none; background: var(--surface);
}
.cal-day:hover { background: var(--bg); }
.cal-day.out { background: var(--bg); }
.cal-day.out .cal-num, .cal-day.out .cal-items { opacity: .45; }
.cal-num { font-size: .85rem; font-weight: 700; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.sun .cal-num { color: var(--sun); } .cal-day.sat .cal-num { color: var(--sat); }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-day.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-items { display: grid; gap: 2px; min-width: 0; }
.cal-item {
  font-size: .75rem; line-height: 1.35; padding: 1px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--mc, var(--accent)) 14%, transparent); color: var(--text);
  border-left: 3px solid var(--mc, var(--accent));
}
.cal-item b { font-weight: 700; }
.cal-day.past .cal-item { opacity: .6; }
.cal-more { font-size: .72rem; color: var(--muted); padding-left: 6px; }
.cal-dots { display: none; gap: 3px; justify-content: center; }
.cal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--mc, var(--accent)); }

@media (max-width: 640px) {
  .cal-card { padding: 12px 8px; }
  .cal-day { min-height: 56px; padding: 4px 2px; align-items: center; }
  .cal-items { display: none; }
  .cal-dots { display: flex; }
}

.day-panel { display: grid; gap: 0; }
.today-badge { font-size: .72rem; font-weight: 700; background: var(--accent); color: #fff; padding: 1px 8px; border-radius: 999px; vertical-align: middle; }
.sched-main { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; }
.sched-main a { font-weight: 700; text-decoration: none; }
.sched-main a:hover { color: var(--accent); }
.sched-item a { text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mc, var(--accent)); flex: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .cal-item b { display: none; } }

/* ---------- 체성분 기록 ---------- */
.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
@media (max-width: 760px) { .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.stat-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.stat-value small { font-size: .85rem; font-weight: 600; color: var(--muted); }
.stat-sub { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.delta-good { color: var(--c-diet-ink); font-weight: 700; }
@media (max-width: 520px) {
  .stat-row { gap: 8px; }
  .stat { padding: 10px; }
  .stat-value { font-size: 1.25rem; }
}

.chart-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 4px; }
.chart-row.stacked { grid-template-columns: 1fr; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-card { margin: 0 0 16px; padding: 16px; }
.chart-row .chart-card { margin-bottom: 0; }
.chart-row { margin-bottom: 16px; }
.chart-title { font-weight: 700; margin-bottom: 8px; }
.chart-empty { margin: 24px 0; text-align: center; }
.chart { display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: 150px 22px; }
.chart-y { position: relative; margin: 10px 0; }
.chart-y span { position: absolute; right: 8px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-plot { position: relative; margin: 10px 14px 10px 6px; }
.chart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
/* 점: 보이는 원은 8px + 2px 바탕색 테두리, 누르는 영역은 28px */
.chart-pt {
  position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 50%;
}
.chart-pt::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; transform: translate(-50%, -50%);
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); transition: width .1s, height .1s;
}
.chart-pt:hover::after, .chart-pt:focus-visible::after { width: 12px; height: 12px; }
.chart-pt:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.chart-end { position: absolute; transform: translate(-50%, -190%); font-size: .8rem; font-weight: 700; color: var(--text); white-space: nowrap; pointer-events: none; }
.chart-x { grid-column: 2; display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); padding: 0 6px; }
.chart-tip {
  position: absolute; z-index: 20; pointer-events: none; opacity: 0; transition: opacity .1s;
  background: var(--text); color: var(--bg); font-size: .8rem; font-weight: 600; padding: 4px 10px; border-radius: 8px; white-space: nowrap;
}
.chart-tip.on { opacity: 1; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.record-form { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 760px) { .record-form { grid-template-columns: 1fr 1fr; } }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { text-align: right; }
@media (max-width: 520px) { .stat-sub .since { display: block; } }

/* 공개 대상: 검색 + 태그 */
.recipients-field.enhanced .pick-list { display: none; }
.rp-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 8px; }
.rp-count { font-size: .85rem; font-weight: 700; margin-right: auto; }
.rp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; max-height: 132px; overflow-y: auto; }
.rp-chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .88rem; }
.rp-x { border: 0; background: none; color: inherit; font-size: 1.05rem; line-height: 1; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; }
.rp-x:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.rp-search { position: relative; }
.rp-search input { margin: 0; background: var(--surface); }
.rp-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  max-height: 300px; overflow-y: auto;
}
.rp-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.rp-item.active, .rp-item:hover { background: var(--accent-soft); }
.rp-empty { padding: 8px 10px; color: var(--muted); font-size: .9rem; }

/* ---------- 회원 로그인: PIN 키패드 ---------- */
.pin-login .auth-card { max-width: 380px; padding: 28px 20px 20px; text-align: center; }
.pin-title { font-size: 1.6rem; line-height: 1.35; margin: 4px 0 16px; }
.pin-error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-size: 1.1rem; font-weight: 700; padding: 12px; border-radius: 12px; margin: 0 0 12px; }
.pin-fallback { text-align: left; margin-bottom: 12px; font-size: 1.1rem; }
.pin-fallback input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; }
.keypad-on .pin-fallback { display: none; }
.pin-dots, .keypad, .pin-show, .pin-status { display: none; }
.keypad-on .pin-dots { display: flex; justify-content: center; gap: 12px; margin: 8px 0 4px; }
.keypad-on .keypad { display: grid; }
.keypad-on .pin-show { display: inline-flex; }
.keypad-on .pin-status { display: block; }
.pin-dot {
  width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); display: grid; place-items: center;
  font-size: 1.1rem; font-weight: 800; color: #fff; transition: background .1s, border-color .1s;
}
.pin-dot.on { background: var(--accent); border-color: var(--accent); }
.pin-status { margin: 4px 0 12px; color: var(--muted); font-size: 1rem; min-height: 1.6em; }
.keypad { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key {
  height: 68px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1.9rem; font-weight: 700; cursor: pointer; touch-action: manipulation; user-select: none;
}
.key:active { background: var(--accent-soft); border-color: var(--accent); transform: scale(.97); }
.key:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.key-fn { font-size: 1.15rem; color: var(--muted); }
.pin-show { gap: 8px; align-items: center; justify-content: center; margin-top: 16px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.pin-show input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.pin-help { margin: 16px 0 0; color: var(--muted); font-size: 1rem; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }

/* 회원 로그인 번호 안내 (트레이너 화면) */
.pin-notice { border: 2px solid var(--accent); background: var(--accent-soft); text-align: center; }
.pin-notice-label { margin: 0; font-weight: 700; }
.pin-notice-value { margin: 4px 0 8px; font-size: 2.6rem; font-weight: 800; letter-spacing: .25em; color: var(--accent); font-variant-numeric: tabular-nums; }
.pin-field { font-size: 1.2rem; letter-spacing: .2em; font-variant-numeric: tabular-nums; }

/* ---------- 영상 화질 선택 · 압축 중 표시 · 디스크 경고 ---------- */
.quality-field { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; }
.quality-field[hidden] { display: none; }
.quality-field legend { font-size: .9rem; font-weight: 600; padding: 0 4px; }
.quality-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
@media (max-width: 520px) { .quality-options { grid-template-columns: 1fr; } }
.quality-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.quality-option input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.quality-option span { display: grid; gap: 2px; }
.quality-option small { color: var(--muted); }
.quality-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.media-wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  aspect-ratio: 16 / 9; margin: 8px 0 12px; border-radius: 10px; background: var(--bg); border: 2px dashed var(--line); padding: 16px; }
.media-wait strong { font-size: 1.05rem; }
.media-wait span:not(.spinner) { color: var(--muted); font-size: .9rem; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.disk-warn { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); padding: 10px 16px; text-align: center; font-size: .92rem; border-bottom: 1px solid var(--line); }

/* ---------- 피드 첨부 (사진·영상 여러 개) ---------- */
.field-label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.media-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.media-list:empty { display: none; }
.media-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface);
}
.media-thumb { width: 64px; height: 64px; flex: none; border-radius: 8px; overflow: hidden; background: #000; }
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-name { flex: 1; min-width: 120px; overflow-wrap: anywhere; }
.media-name strong { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; margin-right: 4px; }
.media-controls { display: flex; gap: 6px; }
.media-controls .btn:disabled { opacity: .35; cursor: default; }
.media-field.js-on .media-remove-check { display: none; }
.media-add { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.media-field.js-on .media-add input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.media-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.media-add-row[hidden], .media-add[hidden] { display: none; }
.media-add { min-height: 48px; font-size: 1rem; }
/* ---------- 첨부 문서 ---------- */
.doc-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.doc-list:empty { display: none; }
.doc-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.doc-icon { font-size: 1.4rem; flex: none; }
.doc-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.doc-field.js-on .media-add input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.post-files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.post-file {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); text-decoration: none;
}
.post-file:hover { border-color: var(--accent); }
.post-file-btn { flex: none; font-weight: 700; color: var(--accent); }
.memo-head { font-weight: 700; margin: 4px 0 -4px; }

/* ---------- 본문 블록 (글·사진·영상) ---------- */
.block-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.block-text { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface); }
.block-kind { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-weight: 600; }
.block-kind .media-controls { margin-left: auto; }
.block-kind strong, .media-name strong { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .85rem; margin-right: 4px; }
.block-text textarea { min-height: 96px; resize: vertical; }
.block-help { margin: 6px 0 0; }
.post .post-body + .media, .post .media + .post-body { margin-top: 4px; }

/* ---------- 피드 글쓰기 칸 (워드처럼: 글 사이 원하는 자리에 사진·영상, 굵게·빨강·파랑) ---------- */
.tc-red  { color: #e5484d; }
/* 글자 크기 (보통 = 1em) */
.ts-s  { font-size: .85em; }
.ts-m  { font-size: 1em; }
.ts-l  { font-size: 1.3em; }
.ts-xl { font-size: 1.7em; line-height: 1.35; }
/* 피드 본문은 처음부터 굵은 글씨 */
.post-body, .editor { font-weight: 700; }
.tc-blue { color: #2563eb; }
.ed-toolbar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 0; background: var(--surface);
}
.ed-toolbar .media-add-row { gap: 8px; }
.ed-format { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.ed-group { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-btn .ts-xl { line-height: 1; }
.ed-btn { min-height: 48px; min-width: 56px; font-size: 1rem; }
.editor {
  position: relative; min-height: 240px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font-size: 1.05rem; line-height: 1.7; overflow-wrap: anywhere; outline: none; cursor: text;
}
.editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 92, 40, .15); }
.editor.is-empty::before {
  content: attr(data-placeholder); position: absolute; top: 14px; left: 16px; right: 16px;
  color: var(--muted); white-space: pre-wrap; pointer-events: none;
}
.ed-media {
  display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; padding: 8px;
  border: 1px dashed var(--line); border-radius: 10px; background: var(--bg); cursor: default; user-select: none;
}
.ed-media-box img, .ed-media-box video { display: block; max-width: min(100%, 320px); max-height: 240px; border-radius: 8px; background: #000; }
.ed-media-box { min-width: 0; flex: 0 1 auto; }
.ed-media-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; flex: none; font-weight: 600; }
.editor-on .block-help { margin-top: 8px; }

/* ---------- 홈 화면에 앱 추가 안내 (partials/install.ejs) ---------- */
.install-bar { background: #fff8e6; border-bottom: 1px solid #f5d98b; }
.hero + .install-bar, .topbar + .install-bar { margin-top: -20px; margin-bottom: 20px; }
.install-bar[hidden], .install-guide[hidden], .install-steps[hidden] { display: none; }
.install-bar-inner { display: flex; align-items: center; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
.install-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.install-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.install-text span { font-size: .85rem; color: var(--muted); }
.install-go { min-height: 44px; white-space: nowrap; flex: none; }
.install-close { flex: none; width: 36px; height: 36px; border: 0; background: none; font-size: 1.1rem; color: var(--muted); cursor: pointer; }
.install-guide {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .55); padding: 16px;
}
.install-sheet { width: 100%; max-width: 440px; background: var(--surface); border-radius: 20px; padding: 22px 20px 20px; }
.install-sheet h2 { margin: 0 0 14px; font-size: 1.2rem; }
.install-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 14px; }
.install-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 1.05rem; line-height: 1.5; }
.install-steps small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.step-no {
  flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 800;
}
.ios-share { white-space: nowrap; color: #0a84ff; }
.ios-share svg { width: 20px; height: 20px; vertical-align: -4px; }
.install-ok { min-height: 52px; font-size: 1.05rem; }
