:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #4a505c;
  --ink-3: #8a909c;
  --line: #e3e6eb;
  --accent: #2f5bea;
  --accent-soft: #e9efff;
  --gt: #0f8a5f;
  --gt-soft: #e6f5ef;
  --warn: #b4540a;
  --warn-soft: #fff3e6;
  --danger: #c8312b;
  --radius: 12px;
  --font: "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.55; }
body { -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.narrow { max-width: 720px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.brand { font-weight: 700; font-size: 15px; color: var(--ink-2); letter-spacing: -0.01em; }
.save-state { font-size: 13px; color: var(--ink-3); }
.save-state.err { color: var(--warn); }

h1 { font-size: 26px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -0.02em; }
h2 { font-size: 18px; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.stack > * + * { margin-top: 16px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 18px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 500; }
.btn:hover { border-color: #c9ced6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* 안내 */
.criteria { display: grid; gap: 10px; }
.crit { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.crit b { display: block; }
.notice { background: var(--warn-soft); color: #6b3305; border-radius: 10px; padding: 12px 14px; font-size: 14px; }

/* 인구통계 폼 */
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; padding-top: 0; }
.q-title { font-weight: 500; margin-bottom: 8px; }
.q-title .req { color: var(--danger); margin-left: 2px; }
.q-hint { font-size: 13px; color: var(--ink-3); margin: -4px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; background: #fff; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.consent { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.consent input { margin-top: 5px; width: 18px; height: 18px; accent-color: var(--accent); }

/* 진행 */
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 14px 0 12px; }
.counter { font-weight: 700; font-size: 15px; }

.sentence { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.sentence .k { font-size: 12px; color: var(--ink-3); font-weight: 500; letter-spacing: .02em; }
.sentence .t { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.sentence .g { font-size: 13px; color: var(--ink-2); margin-top: 4px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: #fff; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.vcard.gt { border: 2px solid var(--gt); }
.vcard.done { border-color: #b9c8f5; }
.vcard.gt.done { border-color: var(--gt); }
.vhead { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; font-weight: 700; }
.vcard.gt .vhead { background: var(--gt-soft); color: var(--gt); }
.vtag { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.vcard video { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; background: #111; display: block; }
.vbody { padding: 12px 14px 16px; }

.score + .score { margin-top: 14px; }
.score-label { font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.sbtn { height: 36px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 500; padding: 0; }
.sbtn:hover { border-color: var(--accent); }
.sbtn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.anchors { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; min-height: 64px; background: #fff; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.hint { font-size: 13px; color: var(--ink-3); align-self: center; }

.landing { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.landing a.card { text-decoration: none; color: inherit; display: block; transition: border-color .15s; }
.landing a.card:hover { border-color: var(--accent); }

@media (max-width: 640px) {
  .wrap { padding: 18px 14px 80px; }
  h1 { font-size: 22px; }
  .grid { grid-template-columns: 1fr; }
  .sbtn { height: 34px; font-size: 13px; }
}

/* 좌 · GT · 우 비교 배치 */
.cmp { display: grid; gap: 14px; grid-template-columns: 1fr 1fr 1fr; align-items: start; }
.cmp .vcard.gt { position: sticky; top: 12px; }
.field { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #fff; }
.field:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.q-title { display: block; }
@media (max-width: 900px) {
  .cmp { grid-template-columns: 1fr 1fr; }
  .cmp .vcard.gt { grid-column: 1 / -1; grid-row: 1; position: static; max-width: 420px; justify-self: center; width: 100%; }
}
@media (max-width: 640px) {
  .cmp { grid-template-columns: 1fr; }
}
