/* Medit Open Community — 공용 스타일. 라이트 기본, html[data-theme=dark] 로 다크. 색은 변수로만. */
:root {
  --paper: #ffffff; --paper-2: #f4f6f9; --paper-3: #e9edf2;
  --ink: #15202b; --ink-2: #51606f; --ink-3: #8a96a6;
  --line: #e2e7ee; --line-2: #cfd7e1;
  --accent: #1f6fe5; --accent-2: #e8f0fd; --accent-ink: #ffffff;
  --ok: #1f9d55; --bad: #d64545; --warn: #c98a00;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --radius: 14px; --radius-s: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --paper: #0f1419; --paper-2: #161c24; --paper-3: #1f2733;
  --ink: #e9eef5; --ink-2: #a6b1be; --ink-3: #6f7b8a;
  --line: #27303c; --line-2: #35404d;
  --accent: #5a95f5; --accent-2: #15263f; --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* ── 머리 ── */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 14px; height: 58px; }
.brand { display: flex; align-items: baseline; gap: 8px; font-weight: 800; letter-spacing: -.01em; font-size: 17px; }
.brand b { color: var(--accent); letter-spacing: .04em; }
.brand span { font-weight: 600; color: var(--ink-2); font-size: 14px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.pri:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--paper-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); }
.chip-user { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); font-size: 14px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-2); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }

/* ── 본문 공통 ── */
main { padding: 26px 0 60px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; line-height: 1.25; }
h2 { font-size: 18px; margin: 28px 0 10px; letter-spacing: -.01em; }
.muted { color: var(--ink-2); }
.tiny { color: var(--ink-3); font-size: 13px; }
.hero { padding: 10px 0 18px; }
.hero p { margin: 0; color: var(--ink-2); font-size: 16px; max-width: 720px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--ink-3); font-size: 13px; }
input[type=text], input[type=search], input[type=password], textarea, select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--paper); outline: none; }
textarea { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 18px; }
.tag { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.tag.on { background: var(--accent-2); border-color: var(--accent); color: var(--accent); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--paper-3); color: var(--ink-2); }
.badge.pub { background: color-mix(in srgb, var(--ok) 14%, var(--paper)); color: var(--ok); }
.badge.priv { background: color-mix(in srgb, var(--warn) 16%, var(--paper)); color: var(--warn); }
.empty { text-align: center; color: var(--ink-3); padding: 50px 0; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; box-shadow: var(--shadow); z-index: 50; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }

/* ── 주제 ── 색은 한 가지 뜻: 어떤 주제인가 */
:root { --tp-case: #1f6fe5; --tp-tip: #1f9d55; --tp-qna: #e07b00; --tp-clinic: #7b4fd6; --tp-lab: #0f8f8f; --tp-daily: #d6457a; }
html[data-theme="dark"] { --tp-case: #5a95f5; --tp-tip: #3fbf78; --tp-qna: #f0a040; --tp-clinic: #a98cf0; --tp-lab: #3fb8b8; --tp-daily: #f07aa6; }
.tp { --tp: var(--tp-case); display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--tp); background: color-mix(in srgb, var(--tp) 12%, var(--paper)); white-space: nowrap; }
.tp::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tp); }
.tp-case { --tp: var(--tp-case); } .tp-tip { --tp: var(--tp-tip); } .tp-qna { --tp: var(--tp-qna); } .tp-clinic { --tp: var(--tp-clinic); } .tp-lab { --tp: var(--tp-lab); } .tp-daily { --tp: var(--tp-daily); }
.topics { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; margin: 0 0 6px; scrollbar-width: none; }
.topics::-webkit-scrollbar { display: none; }
.topics .tpb { --tp: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--paper); color: var(--ink); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s; }
.topics .tpb::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tp); }
.topics .tpb.all::before { display: none; }
.topics .tpb:hover { background: var(--paper-2); }
.topics .tpb.on { border-color: var(--tp); background: color-mix(in srgb, var(--tp) 12%, var(--paper)); color: var(--tp); }
.topics .tpb.all.on { --tp: var(--ink); }
.topic-desc { color: var(--ink-2); font-size: 14px; margin: -2px 0 14px; min-height: 20px; }
.ccard .thumb.text { --tp: var(--tp-case); align-items: flex-start; padding: 16px; background: color-mix(in srgb, var(--tp) 7%, var(--paper-2)); }
.ccard .thumb.text p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ccard .thumb .tp { position: absolute; left: 10px; top: 10px; }
.ccard .thumb { position: relative; }
.tpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.tpick label { --tp: var(--tp-case); display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-s); cursor: pointer; background: var(--paper); transition: border-color .15s, background .15s; }
.tpick label:hover { background: var(--paper-2); }
.tpick label.on { border-color: var(--tp); background: color-mix(in srgb, var(--tp) 10%, var(--paper)); }
.tpick label b { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.tpick label b::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tp); }
.tpick label span { color: var(--ink-3); font-size: 12px; line-height: 1.4; }
.tpick input { position: absolute; opacity: 0; pointer-events: none; }

/* ── 갤러리 ── */
.filters { display: flex; gap: 10px; align-items: center; margin: 4px 0 18px; flex-wrap: wrap; }
.filters .search { flex: 1 1 240px; max-width: 360px; position: relative; }
.filters .search input { padding-left: 36px; }
.filters .search svg { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--ink-3); }
.tagbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; flex: 1 1 100%; }
.tagbar::-webkit-scrollbar { display: none; }
.tagbar .tag { cursor: pointer; height: 30px; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.ccard { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.ccard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16, 24, 40, .06), 0 16px 32px -16px rgba(16, 24, 40, .28); }
.ccard .thumb { aspect-ratio: 16 / 10; background: var(--paper-2); display: flex; align-items: center; justify-content: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.ccard .thumb img { width: 100%; height: 100%; object-fit: cover; }
.ccard .thumb svg { width: 44px; height: 44px; color: var(--line-2); }
.ccard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.ccard .title { font-weight: 700; font-size: 15.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ccard .meta { display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); font-size: 13px; }
.ccard .meta .stats { display: inline-flex; gap: 10px; }
.ccard .tags { margin-top: 2px; }
.ccard .tag { height: 22px; font-size: 11.5px; padding: 0 8px; }
.more { display: flex; justify-content: center; margin: 26px 0 0; }

/* ── 케이스 ── */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); margin-bottom: 12px; font-size: 14px; }
.back:hover { color: var(--ink); }
.vframe { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 72vh; min-height: 320px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #0f1419; box-shadow: var(--shadow); }
.vframe iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.vframe .cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #cbd5e1; background: linear-gradient(180deg, #121a23, #0b1016); font-size: 14px; transition: opacity .25s; }
.vframe .cover.off { opacity: 0; pointer-events: none; }
.vframe .bar { width: 220px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.vframe .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.case-head { display: flex; gap: 18px; align-items: flex-start; margin: 20px 0 6px; flex-wrap: wrap; }
.case-head .info { flex: 1 1 400px; }
.case-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.author { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.desc { white-space: pre-wrap; margin: 14px 0 0; line-height: 1.7; max-width: 820px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.photos a { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.like { gap: 7px; }
.like.on { background: color-mix(in srgb, var(--bad) 10%, var(--paper)); border-color: var(--bad); color: var(--bad); }
.comments { max-width: 820px; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment .body { flex: 1; }
.comment .who { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; }
.comment .who b { font-size: 14px; }
.comment p { margin: 3px 0 0; white-space: pre-wrap; }
.cform { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; }
.cform textarea { min-height: 70px; }
.models-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.models-list .tag { height: 28px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; border: 1px solid rgba(0, 0, 0, .15); }

/* ── 업로드 ── */
.two { display: grid; grid-template-columns: 1.1fr .9fr; gap: 26px; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--ink-2); background: var(--paper-2); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-2); color: var(--accent); }
.drop b { display: block; color: var(--ink); margin-bottom: 4px; }
.flist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.fitem .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fitem select { width: 110px; height: 32px; }
.fitem .x { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 6px; }
.fitem .x:hover { color: var(--bad); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 10px; }
.pgrid div { position: relative; aspect-ratio: 1; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); }
.pgrid img { width: 100%; height: 100%; object-fit: cover; }
.pgrid .x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.tagin { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--paper); cursor: text; }
.tagin:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.tagin input { flex: 1 1 120px; height: 28px; border: 0; padding: 0 4px; background: transparent; }
.tagin input:focus { box-shadow: none; }
.tagin .tag { height: 26px; padding-right: 4px; gap: 4px; }
.tagin .tag button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 3px; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.sugg .tag { cursor: pointer; }
.sugg .tag:hover { border-color: var(--accent); color: var(--accent); }
.radios { display: flex; gap: 14px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; cursor: pointer; }
.consent { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-s); background: var(--paper-2); border: 1px solid var(--line); font-size: 14px; }
.consent input { margin-top: 3px; }
.thumbprev { aspect-ratio: 16 / 10; border-radius: var(--radius-s); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 13px; }
.thumbprev img { width: 100%; height: 100%; object-fit: cover; }
.progress { height: 8px; border-radius: 8px; background: var(--paper-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.sticky-bottom { position: sticky; bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 20px; }
.sticky-bottom .wrap { display: flex; align-items: center; gap: 14px; }
.sticky-bottom .progress { flex: 1; }

/* ── 모달 ── */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 20, .45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal .box { width: 100%; max-width: 400px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; border: 1px solid var(--line); }
.modal h3 { margin: 0 0 4px; font-size: 18px; }
.modal .sub { color: var(--ink-2); font-size: 14px; margin: 0 0 16px; }
.modal .err { color: var(--bad); font-size: 13.5px; min-height: 18px; margin: -6px 0 8px; }
.modal .act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

footer { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; padding: 18px 0 30px; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  .top .wrap { height: 54px; gap: 8px; }
  .brand span { display: none; }
  h1 { font-size: 22px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .ccard .body { padding: 10px 11px 12px; }
  .vframe { aspect-ratio: 1 / 1; min-height: 300px; border-radius: 10px; }
  .hide-m { display: none !important; }
}
