* { box-sizing: border-box; }
body { margin: 0; font-family: "Malgun Gothic", "맑은 고딕", sans-serif; background: #f4f5f7; color: #222; font-size: 17px; }
header { background: #fff; padding: 12px 24px; border-bottom: 1px solid #ddd; display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 18px 0 8px; }
h2 small, .count { font-weight: normal; color: #666; font-size: 15px; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0; font-size: 14px; }
.steps li { padding: 4px 10px; border-radius: 14px; background: #eee; color: #777; }
.steps li.on { background: #2f6fed; color: #fff; }
main { display: grid; grid-template-columns: 340px 1fr; gap: 16px; padding: 16px 24px; }
@media (max-width: 900px) { main { grid-template-columns: 1fr; } }
.panel { background: #fff; border-radius: 10px; padding: 8px 18px 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); align-self: start; }
.drop { border: 3px dashed #9db4e8; border-radius: 10px; padding: 24px 12px; text-align: center; background: #f7faff; }
.drop.over { background: #e3edff; border-color: #2f6fed; }
.drop .big { margin: 0 0 12px; }
.btn { font: inherit; padding: 10px 18px; border: 1px solid #bbb; border-radius: 8px; background: #fff; cursor: pointer; }
.btn:hover { background: #f0f0f0; }
.btn.primary { background: #2f6fed; color: #fff; border-color: #2f6fed; font-weight: bold; }
.btn.primary:hover { background: #2559c4; }
.msg { margin-top: 10px; font-size: 15px; line-height: 1.5; }
.msg .err { color: #b3261e; }
.msg .ok { color: #1b7a3a; }
.slider { display: block; margin: 12px 0; }
.slider span { display: flex; justify-content: space-between; }
.slider input { width: 100%; }
.slider em { font-style: normal; font-size: 14px; color: #666; }
#clear { margin-top: 12px; width: 100%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.card { border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #fafafa; }
.card .img { height: 220px; display: flex; align-items: center; justify-content: center; background: #222; }
.card img { max-width: 100%; max-height: 100%; }
.card .bar { display: flex; gap: 6px; padding: 6px; align-items: center; }
.card .bar .name { flex: 1; font-size: 13px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .bar button { padding: 4px 8px; font: inherit; font-size: 14px; border: 1px solid #bbb; border-radius: 6px; background: #fff; cursor: pointer; }
.empty { color: #888; text-align: center; padding: 40px 0; }

/* 2단계 */
[hidden] { display: none !important; }
.steps li[data-step] { cursor: pointer; }
.next { width: 100%; margin-top: 10px; }
.next:disabled { background: #b9c6e4; border-color: #b9c6e4; cursor: not-allowed; }
.need { color: #b3261e; font-size: 14px; margin: 6px 0 0; min-height: 1em; }
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-bottom: 10px; }
.lay { border: 3px solid transparent; border-radius: 8px; padding: 2px; background: #f4f5f7; cursor: pointer; }
.lay canvas { width: 100%; display: block; }
.lay.on { border-color: #2f6fed; }
.lay:hover { background: #e3edff; }
.tools.off { opacity: .4; pointer-events: none; }
.tools .btn { width: 100%; }
.howto { background: #f7faff; border-radius: 8px; padding: 8px 12px; margin: 14px 0; font-size: 15px; }
.howto ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.6; }
.stage { display: flex; justify-content: center; padding-top: 10px; }
#cv { width: min(100%, 78vh); aspect-ratio: 1; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: grab; touch-action: none; }
#cv.drag { cursor: grabbing; }
.strip { display: flex; gap: 10px; flex-wrap: wrap; }
.strip img { height: 90px; border-radius: 6px; border: 3px solid transparent; cursor: pointer; }
.strip img:hover { border-color: #2f6fed; }
.strip img.cur { border-color: #1b7a3a; }
.msg a { color: #2f6fed; font-weight: bold; }

/* 3단계 */
.hint { text-align: center; color: #555; min-height: 1.4em; margin: 8px 0 0; font-size: 15px; }
#cv.st { cursor: default; }
#cv.st.over { cursor: pointer; }
.panel .btn + .btn { margin-top: 8px; }
.panel > .btn { width: 100%; }

/* 4단계 / 활동 정보 */
.field { display: block; margin: 10px 0; font-size: 15px; color: #444; }
.field input[type=text], .field input[type=date], .field select { display: block; width: 100%; margin-top: 4px; font: inherit; padding: 8px 10px; border: 1px solid #bbb; border-radius: 6px; }
.chk { display: block; margin: 6px 0; font-size: 15px; }
.chk.big { font-size: 17px; font-weight: bold; margin: 10px 0; }
.infoShow { background: #f1f6ff; border-radius: 6px; padding: 6px 10px; margin: 6px 0 0; font-size: 15px; min-height: 1.4em; }
.txPreview { background: #333; color: #fff; border-radius: 6px; padding: 6px 10px; font-weight: bold; margin: 0 0 6px; min-height: 1.4em; }
.em { font-size: 14px; color: #666; }
#cv.rect { cursor: crosshair; }

/* 5단계 */
.checklist { list-style: none; padding: 0; margin: 0 0 6px; font-size: 15px; line-height: 1.5; }
.checklist li { padding: 4px 0 4px 26px; position: relative; }
.checklist li::before { content: "✔"; position: absolute; left: 4px; color: #1b7a3a; }
.checklist li.warn { color: #b3261e; }
.checklist li.warn::before { content: "!"; color: #b3261e; font-weight: bold; }
.fname { background: #f1f6ff; border-radius: 6px; padding: 8px 10px; word-break: break-all; }
.chk small { font-weight: normal; color: #666; font-size: 14px; }
.chk.indent { margin-left: 28px; }
.next.big { font-size: 20px; padding: 14px; }

/* 사이트판 */
body { font-family: "Noto Sans KR", "Malgun Gothic", "맑은 고딕", sans-serif; }
.safe { margin: 0; font-size: 14px; color: #1b7a3a; }
.card .img canvas { max-width: 100%; max-height: 100%; }
.strip canvas { height: 90px; width: auto; border-radius: 6px; border: 3px solid transparent; cursor: pointer; }
.strip canvas:hover { border-color: #2f6fed; }
.strip canvas.cur { border-color: #1b7a3a; }
.busy { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 10; background: #222; color: #fff; padding: 10px 18px; border-radius: 20px; font-size: 15px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.card .img canvas { cursor: pointer; }
.card .bar button[data-act=edit] { font-weight: bold; }

/* 스티커 모양 */
.stTypes { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.stTypes button { border: 3px solid transparent; border-radius: 10px; background: #f4f5f7; padding: 4px 2px; cursor: pointer; font: inherit; font-size: 12px; color: #444; }
.stTypes button canvas { width: 44px; height: 44px; display: block; margin: 0 auto 2px; }
.stTypes button.on { border-color: #2f6fed; background: #e3edff; }

/* 사진 편집 창 */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modalBox { background: #fff; border-radius: 12px; padding: 4px 18px 16px; width: min(1100px, 100%); max-height: 100%; overflow: auto; }
.modalBox h2 small { font-size: 14px; }
.modalBox h3 { font-size: 15px; margin: 12px 0 6px; }
.edMain { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.edStage { display: flex; justify-content: center; align-items: center; background: #222; border-radius: 8px; padding: 10px; }
#edCv { max-width: 100%; max-height: 62vh; touch-action: none; cursor: move; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { font: inherit; font-size: 15px; padding: 8px 12px; border: 1px solid #bbb; border-radius: 18px; background: #fff; cursor: pointer; }
.chips button.on { background: #2f6fed; border-color: #2f6fed; color: #fff; }
#edReset { width: 100%; margin-top: 12px; }
.edBtns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.edBtns .btn { min-width: 120px; }
body.noscroll { overflow: hidden; }

/* 휴대폰·좁은 화면 */
@media (max-width: 900px) {
  body { font-size: 16px; }
  header { padding: 8px 12px; gap: 6px; }
  h1 { font-size: 18px; }
  .steps { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .steps li { white-space: nowrap; padding: 6px 12px; }
  .safe { font-size: 13px; }
  main { padding: 10px 10px 24px; gap: 10px; }
  .panel { padding: 4px 12px 14px; }
  /* 2~5단계는 콜라주를 위에, 조절 도구를 아래에 */
  #view2 .wide, #view3 .wide, #view4 .wide, #view5 .wide { order: -1; }
  #cv { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .card .img { height: 150px; }
  .card .bar { flex-wrap: wrap; }
  .card .bar .name { flex-basis: 100%; }
  .card .bar button { flex: 1; padding: 8px 4px; }
  .btn { min-height: 46px; }
  input[type=range] { height: 32px; }
  .edMain { grid-template-columns: 1fr; }
  #edCv { max-height: 50vh; }
  .modal { padding: 6px; }
  .modalBox { padding: 2px 12px 12px; }
  .edBtns { position: sticky; bottom: -12px; background: #fff; padding: 8px 0; }
  .edBtns .btn { flex: 1; }
}
