/* 레이아웃: 상단바 + 중앙 960px 단일 컬럼, 목록은 당근식 가로 카드, 상세는 본문+사이드 2단 */
:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #142a26;
  --muted: #5b6e69;
  --line: #dce4e1;
  --accent: #0b7a68;      /* 서해 갯벌 청록 */
  --accent-ink: #ffffff;
  --accent-soft: #e0f1ec;
  --hot: #d9472b;         /* 마감임박 */
  --hot-soft: #fde7e1;
  --free: #1d6fd1;
  --closed: #8a9693;
  --shadow: 0 1px 2px rgba(20, 42, 38, .06), 0 4px 14px rgba(20, 42, 38, .05);
  --f-display: "Black Han Sans", "IBM Plex Sans KR", sans-serif;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1715; --surface: #17221f; --ink: #e5eeeb; --muted: #97aaa5; --line: #273633;
    --accent: #3cc2a6; --accent-ink: #062520; --accent-soft: #163a33; --hot: #ff7a5c; --hot-soft: #3d1f18;
    --free: #6fb0ff; --closed: #6c7a77; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1715; --surface: #17221f; --ink: #e5eeeb; --muted: #97aaa5; --line: #273633;
  --accent: #3cc2a6; --accent-ink: #062520; --accent-soft: #163a33; --hot: #ff7a5c; --hot-soft: #3d1f18;
  --free: #6fb0ff; --closed: #6c7a77; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--f-body); word-break: keep-all; }
a { color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1000px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.selectable { user-select: all; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--hot); border-color: var(--hot); background: transparent; }
.btn-liked { color: var(--hot); border-color: var(--hot); background: var(--hot-soft); }
.btn-block { width: 100%; } .btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; } .btn-lg { min-height: 50px; font-size: 16px; padding: 0 28px; }
.btn:disabled { opacity: .6; cursor: progress; }

/* 상단바 */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--surface); }
.topbar-inner { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: baseline; gap: 4px; text-decoration: none; }
.logo-mark { font: 24px/1 var(--f-display); color: var(--accent-ink); background: var(--accent); padding: 6px 7px 4px; border-radius: 8px; }
.logo-text { font: 22px/1 var(--f-display); }
.logo-text small { font: 600 12px var(--f-body); color: var(--accent); margin-left: 2px; }
.region-pick select { min-height: 36px; border: 1px solid var(--line); border-radius: 999px; padding: 0 30px 0 14px; background: var(--bg); color: var(--ink); font: 600 14px var(--f-body); }
.topnav { margin-left: auto; display: flex; gap: 8px; }

.demo-banner { background: var(--accent-soft); color: var(--ink); font-size: 13px; padding-block: 8px; }
.demo-banner code { font-size: 12px; background: var(--surface); padding: 1px 5px; border-radius: 4px; }

main { padding-block: 24px 64px; display: block; outline: none; }

/* 히어로 */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: stretch; margin-bottom: 20px; }
.hero-copy { min-width: 0; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.hero h1 { font: 34px/1.25 var(--f-display); margin: 0 0 18px; text-wrap: balance; letter-spacing: -.01em; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; min-height: 50px; border: 2px solid var(--ink); border-radius: 12px; padding: 0 16px; font: 16px var(--f-body); background: var(--surface); color: var(--ink); }
.search .btn { min-height: 50px; padding: 0 22px; }

/* 광고 */
.ad { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: var(--r); text-decoration: none; border: 1px dashed var(--line); background: var(--surface); min-width: 0; }
.ad strong { font-size: 16px; line-height: 1.35; }
.ad-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ad-body { color: var(--muted); font-size: 13px; }
.ad:not(.ad-empty) { border-style: solid; }
.ad:not(.ad-empty):hover strong { color: var(--accent); }
.ad-img { display: block; border-radius: 8px; overflow: hidden; background: var(--line); }
.ad-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ad-has-img { gap: 10px; padding: 12px; }
.ad-banner .ad-img { aspect-ratio: 2 / 1; }
.ad-side .ad-img { aspect-ratio: 3 / 2; }
.ad-inline.ad-has-img { flex-direction: row; align-items: center; gap: 16px; }
.ad-inline .ad-img { flex: none; width: 112px; height: 112px; }
@media (max-width: 520px) { .ad-inline .ad-img { width: 92px; height: 92px; } }
.ad-label { align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.ad-banner { height: 100%; justify-content: center; }
.ad-empty:hover { border-color: var(--accent); }

/* 분야 칩 */
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 20px; scrollbar-width: thin; }
.cat { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px var(--f-body); cursor: pointer; }
.cat.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* 마감 임박 */
.soon-strip { margin-bottom: 28px; }
.soon-strip h2, .list-head h2 { font-size: 18px; margin: 0 0 10px; }
.soon-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.soon { flex: 0 0 220px; display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); text-decoration: none; box-shadow: var(--shadow); }
.soon strong { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.soon small { color: var(--muted); }
.soon .dday { position: static; align-self: flex-start; }

/* 목록 */
.list-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--ink); padding-bottom: 10px; }
.list-head h2 { margin: 0; font-variant-numeric: tabular-nums; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters select { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--surface); color: var(--ink); font: 14px var(--f-body); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.list { display: flex; flex-direction: column; }
.card { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.card:hover h3 { color: var(--accent); }
.card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.card h3 { margin: 0; font-size: 16px; line-height: 1.4; font-weight: 600; }
.card .org { margin: 0; color: var(--muted); font-size: 13px; }
.meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0 6px; color: var(--muted); font-size: 13px; }
.meta span + span::before { content: "·"; margin-right: 6px; }
.price { margin: 2px 0 0; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.price.free, dd.free { color: var(--free); }
.stats { margin: auto 0 0; display: flex; justify-content: flex-end; gap: 10px; color: var(--muted); font-size: 12px; }
.ad-inline { margin: 14px 0; }

/* 썸네일 */
.thumb { position: relative; flex: none; width: 112px; height: 112px; border-radius: var(--r); overflow: hidden; display: grid; place-items: center;
  background: hsl(var(--h) 45% 88%); color: hsl(var(--h) 55% 24%); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-cat { font: 17px/1.2 var(--f-display); text-align: center; padding: 8px; }
.thumb.thumb-big { width: 100%; height: 200px; margin-bottom: 18px; }
.thumb-big .thumb-cat { font-size: 34px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .thumb { background: hsl(var(--h) 30% 22%); color: hsl(var(--h) 60% 82%); } }
:root[data-theme="dark"] .thumb { background: hsl(var(--h) 30% 22%); color: hsl(var(--h) 60% 82%); }
.dday { position: absolute; left: 6px; top: 6px; font: 700 12px/1 var(--f-body); padding: 4px 6px; border-radius: 6px; background: var(--surface); color: var(--ink); font-variant-numeric: tabular-nums; }
.dday-soon { background: var(--hot); color: #fff; }
.dday-closed { background: var(--closed); color: #fff; }
.dday-open { background: var(--surface); color: var(--accent); }

/* 상세 */
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; font-weight: 600; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.detail-main { min-width: 0; }
.detail-head h1 { font-size: 26px; line-height: 1.35; margin: 0 0 8px; text-wrap: balance; }
.org-line { margin: 0 0 20px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.org-badge { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.facts { margin: 0 0 24px; display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 80px 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; min-width: 0; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.pill-open { background: var(--accent-soft); color: var(--accent); }
.pill-soon { background: var(--hot-soft); color: var(--hot); }
.pill-closed { background: var(--line); color: var(--muted); }
.desc h2 { font-size: 17px; margin: 0 0 8px; }
.desc p { margin: 0 0 20px; max-width: 65ch; }
.detail-side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 76px); display: flex; flex-direction: column; gap: 14px; }
.apply-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.apply-dday { margin: 0; font: 32px/1 var(--f-display); background: none !important; }
.apply-dday.dday-soon { color: var(--hot); } .apply-dday.dday-open { color: var(--accent); } .apply-dday.dday-closed { color: var(--closed); }
.contact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0; border-block: 1px solid var(--line); }
.contact span { color: var(--muted); font-size: 13px; }
.apply-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.confirm p { margin: 0; width: 100%; font-size: 13px; }
.ad-side { min-height: 120px; }

/* 폼 */
.form-wrap { max-width: 680px; }
.form-wrap.narrow { max-width: 440px; }
.form-wrap h1 { font: 28px/1.3 var(--f-display); margin: 0 0 6px; }
.form { display: flex; flex-direction: column; gap: 18px; margin-top: 20px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 16px 18px 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.form label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.form input, .form select, .form textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font: 15px var(--f-body); background: var(--bg); color: var(--ink); }
.form textarea { resize: vertical; line-height: 1.6; }
.form input:disabled { opacity: .5; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }
.hint { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.form-err { margin: 0; color: var(--hot); font-weight: 600; }

/* 기타 */
.empty { padding: 48px 0; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty p { margin: 0; }
.prose { max-width: 680px; }
.prose h1 { font: 28px/1.3 var(--f-display); }
.plan { width: 100%; border-collapse: collapse; margin: 12px 0 20px; }
.plan th, .plan td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
.footer { border-top: 1px solid var(--line); background: var(--surface); padding-block: 28px; font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }
.footer strong { color: var(--ink); }
.footer p { margin: 4px 0 0; }
.footer-links { display: flex; gap: 16px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 50; max-width: calc(100% - 32px); }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .facts { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px; padding-block: 8px; }
  .topnav { margin-left: auto; }
  .region-pick { order: 3; width: 100%; } .region-pick select { width: 100%; }
  .logo-text small { display: none; }
  .thumb { width: 92px; height: 92px; }
  .row, .row-3 { grid-template-columns: 1fr; }
}
/* 포스터 이미지 */
.thumb img { object-position: top center; }
.poster { position: relative; display: block; margin-bottom: 18px; border-radius: var(--r); overflow: hidden; background: var(--line); }
.poster img { display: block; margin: 0 auto; max-width: 100%; max-height: 560px; width: auto; height: auto; }
.poster-pick { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.poster-preview img { display: block; max-height: 220px; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.poster-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form label.btn { margin: 0; color: var(--ink); font-size: 14px; font-weight: 600; }
#f_poster:focus-visible + label { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 회원가입 · 내 정보 */
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label.choice { margin: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); cursor: pointer; }
.form label.choice input { width: auto; min-height: 0; margin-top: 4px; grid-row: span 2; accent-color: var(--accent); }
.choice strong { font-size: 15px; }
.choice span { font-size: 13px; font-weight: 400; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.form .agree label, .form .agree-item, .form .agree-all { color: var(--ink); font-weight: 500; font-size: 14px; }
.agree-all { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: 0 0 4px; border-radius: 8px; background: var(--accent-soft); cursor: pointer; }
.agree-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0 0; }
.agree-item > label, label.agree-item { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; justify-content: flex-start; }
.form .agree input[type=checkbox], .form .me input[type=checkbox], .agree-all input { width: 18px; height: 18px; min-height: 0; flex: none; accent-color: var(--accent); }
.agree b { color: var(--accent); font-weight: 700; }
.consent-wrap { overflow-x: auto; margin: 4px 0; }
.consent { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
.consent th, .consent td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.consent th { background: var(--bg); color: var(--muted); font-weight: 600; }
.me-section { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); }
.me-section h2 { font-size: 17px; margin: 0 0 10px; }
.my-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.danger-zone h2 { color: var(--hot); }
.confirm input { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); color: var(--ink); font: 15px var(--f-body); width: 120px; }
.legal h2 { font-size: 17px; margin: 24px 0 6px; }
.legal ol, .legal ul { padding-left: 20px; }
@media (max-width: 520px) { .choice-row { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
