/* 글꼴: 네이버 첫 화면과 같은 구성. 본문은 시스템 글꼴(윈도 맑은 고딕, 맥 Apple SD 산돌고딕 Neo), 제목은 나눔스퀘어(SIL OFL) */
@font-face { font-family: "NanumSquare"; font-weight: 400; font-display: swap; src: url("https://ekhmcnqffpwscrwckfmb.supabase.co/storage/v1/object/public/media/site/fonts/NanumSquareR.woff2") format("woff2"); }
@font-face { font-family: "NanumSquare"; font-weight: 700; font-display: swap; src: url("https://ekhmcnqffpwscrwckfmb.supabase.co/storage/v1/object/public/media/site/fonts/NanumSquareB.woff2") format("woff2"); }
@font-face { font-family: "NanumSquare"; font-weight: 800; font-display: swap; src: url("https://ekhmcnqffpwscrwckfmb.supabase.co/storage/v1/object/public/media/site/fonts/NanumSquareEB.woff2") format("woff2"); }
/* 레이아웃: 휴대폰 한 열(최대 520px) + 아래 탭 막대. 맨 위에 움직이는 '표본 캡슐' 하나, 큰 시작 단추 하나. */
:root {
  --bg: #fff7ec;          /* 따뜻한 상아 */
  --card: #ffffff;
  --ink: #2b2230;
  --muted: #7a6f78;
  --line: #f0e3d2;
  --muscle: #e0574b;      /* 근육 산호색 */
  --muscle-ink: #ffffff;
  --bone: #f4e6c8;
  --glass: #e9f3f6;       /* 캡슐 유리 */
  --teal: #1f8c89;
  --kakao: #fee500;
  --kakao-ink: #191919;
  --shadow: 0 6px 24px rgba(120, 70, 40, .10);
  --f-display: "NanumSquare", -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", helvetica, "Apple SD Gothic Neo", sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, "Malgun Gothic", "맑은 고딕", helvetica, "Apple SD Gothic Neo", sans-serif;
  --r: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17131a; --card: #221c26; --ink: #f4ecef; --muted: #b3a6b0; --line: #342b38;
    --muscle: #ff7466; --muscle-ink: #2a0d0a; --bone: #3a3125; --glass: #1d2c31; --teal: #5cc8c3;
    --shadow: 0 6px 24px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--f-body); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: break-word; }
body { padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) calc(84px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
#app { max-width: 520px; margin: 0 auto; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* 첫 화면 */
.hero { display: grid; justify-items: center; text-align: center; gap: 14px; padding-top: 22px; }
.brand { font-family: var(--f-display); font-weight: 800; font-size: .95rem; letter-spacing: .08em; color: var(--muscle); }
.capsule {
  width: min(78vw, 300px); aspect-ratio: 3 / 4; border-radius: 48% 48% 40px 40px / 30% 30% 40px 40px;
  background: radial-gradient(120% 80% at 50% 10%, var(--card), var(--glass));
  border: 6px solid var(--card); box-shadow: var(--shadow), inset 0 0 0 2px var(--line);
  position: relative; overflow: hidden; display: grid; place-items: center;
}
.capsule canvas { width: 100%; height: 100%; display: block; }
.capsule .tag {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); white-space: nowrap;
  background: var(--card); border-radius: 999px; padding: 4px 12px; font-size: .8rem; box-shadow: var(--shadow);
}
.hero h1 { font-size: 2rem; line-height: 1.2; }
.hero p { margin: 0; }
.cta { display: grid; gap: 10px; width: 100%; max-width: 360px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 54px; border-radius: 16px;
  border: 0; font-size: 1.05rem; font-weight: 700; text-decoration: none; padding: 0 18px;
}
.btn-kakao { background: var(--kakao); color: var(--kakao-ink); }
.btn-main { background: var(--muscle); color: var(--muscle-ink); }
.btn-line { background: var(--card); border: 2px solid var(--line); }
.btn-ghost { background: none; border: 0; text-decoration: underline; min-height: 40px; font-weight: 400; color: var(--muted); }
.btn[disabled] { opacity: .5; cursor: default; }
.btn svg { width: 22px; height: 22px; }
.alt-login { display: flex; justify-content: center; gap: 14px; font-size: .9rem; }
.alt-login button { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 6px; }

/* 부위 카드 */
.section { margin-top: 30px; display: grid; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.section-head h2 { font-size: 1.4rem; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; text-decoration: none;
  display: grid; grid-template-rows: auto auto; border: 1px solid var(--line);
}
.card .thumb { aspect-ratio: 1; background: var(--glass); display: grid; place-items: center; position: relative; }
.card .thumb img { width: 86%; height: 86%; object-fit: contain; }
.card .no { position: absolute; top: 8px; left: 10px; font-family: var(--f-display); font-weight: 700; color: var(--muted); font-size: .85rem; }
.card .body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.card .t { font-family: var(--f-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.badge { display: inline-block; font-size: .72rem; padding: 1px 8px; border-radius: 999px; background: var(--bone); width: fit-content; }
.badge.free { background: var(--teal); color: #fff; }
.price { font-family: var(--f-display); font-weight: 800; color: var(--muscle); }

/* 부위 안 목록 */
.top { display: flex; align-items: center; gap: 10px; padding-block: 16px 8px; position: sticky; top: env(safe-area-inset-top, 0px); background: var(--bg); z-index: 5; }
.top a.back { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--card); box-shadow: var(--shadow); text-decoration: none; font-size: 1.3rem; }
.top h1 { font-size: 1.5rem; flex: 1; min-width: 0; }
.steps { display: grid; gap: 10px; }
.step-title { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; color: #fff; }
.s-뼈 { background: #b8913f; } .s-근육 { background: #e0574b; } .s-기능 { background: #4b5fb4; } .s-동작 { background: #2c8a5f; }
.row-item {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--card);
  text-decoration: none; border: 1px solid var(--line);
}
.row-item img { width: 56px; height: 56px; object-fit: contain; background: var(--glass); border-radius: 10px; }
.row-item .t { flex: 1; min-width: 0; }
.lock { font-size: 1.1rem; }

/* 플레이어 */
.stage { position: relative; background: var(--glass); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.stage canvas { display: block; width: 100%; height: min(62vh, 560px); touch-action: none; }
.cue { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(43, 34, 48, .85); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: .9rem; text-align: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { text-decoration: none; border: 2px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; font-size: .9rem; }
.chip[aria-pressed="true"] { border-color: var(--muscle); background: var(--muscle); color: var(--muscle-ink); }
.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ctl { min-height: 58px; border-radius: 16px; border: 0; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; font-size: .82rem; gap: 2px; padding: 6px 0; }
.ctl b { font-size: 1.15rem; line-height: 1; font-family: var(--f-display); font-weight: 800; }
.ctl[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.scrub { width: 100%; accent-color: var(--muscle); }
.note { background: var(--card); border-radius: var(--r); padding: 14px 16px; border: 1px solid var(--line); }
.paywall { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(6px); }
.paywall .box { display: grid; gap: 10px; max-width: 300px; }

/* 게시판 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.list { display: grid; gap: 8px; }
.post-row { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-decoration: none; display: grid; gap: 2px; }
.post-row .t { font-weight: 700; overflow-wrap: anywhere; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.field { display: grid; gap: 6px; }
.field input, .field textarea, .field select { width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px; }
.field textarea { min-height: 200px; resize: vertical; }
.field input { font-size: 16px; } /* iOS 가 16px 미만 입력칸을 확대하지 않도록 */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 72px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--line); color: var(--ink, inherit); font-size: .85rem; font-weight: 700; }
#liHint { color: var(--accent, #e0574b); line-height: 1.5; }
.comment { border-top: 1px solid var(--line); padding-block: 10px; display: grid; gap: 2px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: .85rem; padding: 0; }
.stack { display: grid; gap: 12px; }
.panel { background: var(--card); border-radius: var(--r); padding: 16px; border: 1px solid var(--line); display: grid; gap: 10px; }
.kv { display: grid; grid-template-columns: 6em minmax(0, 1fr); gap: 6px 10px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.legal { font-size: .78rem; color: var(--muted); margin-top: 34px; display: grid; gap: 4px; }
.legal a { color: inherit; }
.doc h2 { font-size: 1.15rem; margin-top: 18px; }
.doc p, .doc li { font-size: .92rem; }

/* 아래 탭 막대 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.tabbar a { display: grid; justify-items: center; gap: 2px; text-decoration: none; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.tabbar a.on { color: var(--muscle); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; z-index: 30; max-width: calc(100% - 32px); }
.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: end center; z-index: 40; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; border-radius: 22px 22px 0 0; padding: 20px max(16px, env(safe-area-inset-left, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 12px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 무료 공개 띠 */
.ribbon { background: var(--teal); color: #fff; border-radius: 999px; padding: 4px 14px; font-size: .85rem; }

/* 가입 시트 */
.sheet { max-height: 92vh; overflow-y: auto; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.agree { display: grid; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: .9rem; }
.agree label, .agree-row { display: flex; gap: 8px; align-items: center; }
.agree label:first-child { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.agree input, .agree-row input { width: 20px; height: 20px; accent-color: var(--muscle); flex: none; }
.agree a { color: var(--teal); }

/* 하단: KairoX·SimVEX 홍보 */
.site-foot { margin-top: 40px; padding-top: 22px; border-top: 1px dashed var(--line); display: grid; gap: 14px; }
.bf-lead { margin: 0; text-align: center; font-size: .92rem; color: var(--muted); }
.bf-lead b { color: var(--ink); }
.bf-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bf-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 2px; text-decoration: none; box-shadow: var(--shadow); min-width: 0; }
.bf-role { font-size: .72rem; letter-spacing: .12em; color: var(--muted); }
.bf-wm { font-family: "Space Grotesk", var(--f-display); font-weight: 700; font-size: 1.6rem; line-height: 1.1; letter-spacing: -.02em; }
.bf-wm b { color: var(--muscle); font-weight: 700; }
.bf-ko { font-size: .8rem; color: var(--muted); }
.bf-desc { font-size: .82rem; margin-top: 6px; line-height: 1.5; }
.bf-next { margin: 0; text-align: center; font-size: .82rem; color: var(--muted); }
.site-foot .legal { margin-top: 6px; }
@media (max-width: 340px) { .bf-cards { grid-template-columns: 1fr; } }

/* 끌어서 돌리기 안내 */
.stage canvas:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }
.drag-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: .82rem; color: var(--ink); box-shadow: var(--shadow); animation: hintPulse 2.4s ease-in-out 3;
}
@keyframes hintPulse { 0%, 100% { transform: translateX(-50%); } 50% { transform: translateX(calc(-50% + 6px)); } }

/* 오른쪽 위 계정 표시 */
.acct { position: fixed; z-index: 25; top: calc(10px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }
.acct-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: .85rem; box-shadow: var(--shadow); min-height: 36px;
}
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid; gap: 2px;
}
.acct-menu[hidden] { display: none; }
.acct-mail { font-size: .78rem; color: var(--muted); padding: 8px 10px 6px; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.acct-menu a, .acct-menu button { text-align: left; text-decoration: none; background: none; border: 0; padding: 10px; border-radius: 10px; font-size: .92rem; min-height: 40px; }
.acct-menu a:hover, .acct-menu button:hover { background: var(--bg); }
.acct-out { color: var(--muscle); font-weight: 700; }
/* 위쪽 고정 제목 줄과 겹치지 않게 */
.top { padding-right: 120px; }

/* 부위 카드: 그림 칸은 정사각형으로 고정하고(그림 크기가 칸을 늘리지 않게), 글자 칸이 잘리지 않게 */
.card { display: flex; flex-direction: column; overflow: hidden; }
.card .thumb { aspect-ratio: 1 / 1; width: 100%; height: auto; flex: none; position: relative; overflow: hidden; }
.card .thumb img { position: absolute; left: 7%; top: 7%; width: 86%; height: 86%; object-fit: contain; }
.card .body { flex: 1 0 auto; padding: 10px 12px 14px; }
/* 3D 모형 보기 */
.s-입체 { background: #7a3fb8; }
.stage3d { height: min(66vh, 600px); background: radial-gradient(120% 90% at 50% 30%, color-mix(in srgb, var(--glass) 70%, #fff) 0%, var(--glass) 70%); }
.stage3d canvas { width: 100%; height: 100%; cursor: grab; }
.stage3d canvas:active { cursor: grabbing; }
.loading3d { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink, inherit); font-size: .95rem; pointer-events: none; }
.pick { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); display: grid; gap: 2px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--card) 92%, transparent); box-shadow: var(--shadow); font-size: .9rem; pointer-events: none; }
.pick span { font-size: .8rem; opacity: .75; }
.pick em { font-style: normal; font-size: .75rem; color: var(--muscle); }
.chips .chip i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.chips .chip[aria-pressed="false"] { opacity: .55; }
.xray { display: flex; align-items: center; gap: 10px; }
.xray input { flex: 1; accent-color: var(--muscle); }
.clin { background: var(--card); border: 2px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.clin summary { cursor: pointer; font-weight: 700; }
.clin ul { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.clin li p { margin: 4px 0 0; line-height: 1.6; }
.clin sup { font-size: .7em; color: var(--muscle); }
.clin .k-artery { color: #c4212a; } .clin .k-vein { color: #2f62c4; } .clin .k-pulmonary_artery { color: #5a4fcf; } .clin .k-pulmonary_vein { color: #d04a5e; }
.clin .refs { margin: 12px 0 4px; padding-left: 22px; display: grid; gap: 4px; overflow-wrap: anywhere; }
/* 관리자 2트랙 설정 */
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tier-ch { gap: 6px; }
.tier-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.tier-row .t { min-width: 0; }
.chip.tier { flex: none; min-width: 64px; }
.chip.tier[aria-pressed="false"] { opacity: 1; background: var(--card); color: inherit; }
