/* 섬 미션 강조 층(2026-10-10 업그레이드) — docs/DESIGN_SYSTEM_v4.md 토큰 그대로(먹·흰 종이·빨강 한두 곳, 버튼 10px·패널 16px).
   index.html에서 v4.css 다음에 불러온다. 담는 것:
   1) 첫 안내창 = 미션 브리핑   2) 섬 미션 안내판(#mission-hub, 데스크톱 목록 / 모바일 한 줄)
   3) 미션 존 맨 위 미션 카드   4) 강의 견본 영상   5) 쿠폰 창 상태별 정리·도장 연출·다음 단계   6) 390px HUD 한 줄
   자동 움직임은 없다. 도장·발급 연출은 사람이 한 동작(다섯째 도장, 발급 버튼)에 답하는 한 번뿐이고 prefers-reduced-motion에서 끈다. */

/* ── 1) 첫 안내창: 미션 브리핑 ── */
.intro {
  width: min(468px, calc(100vw - 56px)); grid-template-columns: 1fr; gap: 0;
  padding: 26px 28px 20px; max-height: calc(100dvh - 32px); overflow-y: auto;
}
.intro-duron { position: absolute; right: 20px; top: 18px; width: 70px; }
.intro-body { min-width: 0; }
.intro-eyebrow { margin: 0 0 14px; padding-right: 84px; font: 700 12.5px/1.4 var(--body); letter-spacing: .01em; color: var(--v4-muted); }
.intro h2 { font-size: 27px; line-height: 1.36; margin-bottom: 10px; padding-right: 64px; }
.intro-desc { margin: 0 0 14px; font-size: 15px; line-height: 1.6; color: var(--v4-ink-2); word-break: keep-all; }
.intro-missions { list-style: none; margin: 0 0 14px; padding: 0; border-top: 1px solid var(--v4-line); }
.intro-missions li {
  display: grid; grid-template-columns: 22px auto 1fr; align-items: center; gap: 10px;
  padding: 8px 2px; border-bottom: 1px solid var(--v4-line); font-size: 14.5px; color: var(--v4-ink);
}
.intro-missions span {
  width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--v4-ink);
  display: grid; place-items: center; font: 700 11.5px/1 var(--body);
}
.intro-missions b { font-weight: 700; white-space: nowrap; }
.intro-missions small { font-size: 13px; color: var(--v4-muted); text-align: right; word-break: keep-all; }
.intro-meta { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.intro-meta li { font: 600 12.5px/1 var(--body); color: var(--v4-ink); background: var(--v4-mist); border-radius: 999px; padding: 7px 11px; }
.intro-meta li:first-child { background: var(--v4-ink); color: #fff; }
.intro-actions { gap: 8px 16px; }
.intro .intro-actions .btn-main { min-height: 50px; min-width: 196px; font-size: 16px; justify-content: center; }
.intro-trust {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px;
  margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--v4-line);
  font-size: 12.5px; line-height: 1.5; font-weight: 600; color: var(--v4-ink-2);
}
.intro-trust span { display: inline; }
.intro-trust .linkbtn { margin: 0; padding: 6px 0; font-size: 12.5px; color: var(--v4-ink); }
.intro-areas { display: none; }

/* ── 2) 섬 미션 안내판(데스크톱: 왼쪽 위 목록) ── */
.mission-hub {
  position: fixed; z-index: 19; left: 18px; top: calc(max(12px, env(safe-area-inset-top)) + 66px); width: 290px;
  background: #fff; border: 1px solid var(--v4-line); border-radius: 16px; box-shadow: var(--v4-float);
  padding: 14px 14px 12px; color: var(--v4-ink); font-family: var(--body);
  transition: opacity .2s;
}
.mission-hub:not([hidden]) { display: flex; flex-direction: column; }
.mission-hub .mh-cta { order: 5; }
.mission-hub[hidden] { display: none; }
body.poster .mission-hub, body.intro-open .mission-hub, body.is-loading .mission-hub, body.mode-text .mission-hub,
body.poster-shot .mission-hub, body.printing-roadmap .mission-hub, body.npc-open .mission-hub { opacity: 0; visibility: hidden; pointer-events: none; }
.mh-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mh-title { margin: 0; display: flex; align-items: baseline; gap: 8px; }
.mh-title b { font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.mh-title span { font-size: 12.5px; font-weight: 600; color: var(--v4-muted); }
.mh-fold {
  border: 0; background: none; padding: 6px 2px; min-height: 32px; cursor: pointer;
  font: 600 12.5px var(--body); color: var(--v4-muted); text-decoration: underline; text-underline-offset: 3px;
}
.mh-fold:hover { color: var(--v4-ink); }
.mh-bar { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 8px 0 8px; }
.mh-bar i { height: 4px; border-radius: 999px; background: var(--v4-track); transition: background .3s; }
.mh-bar i.on { background: var(--v4-red); }
.mh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mh-list button {
  width: 100%; display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 10px; min-height: 44px;
  border: 0; background: transparent; border-radius: 10px; padding: 6px 8px; cursor: pointer;
  text-align: left; font: inherit; color: var(--v4-ink);
}
.mh-list button:hover { background: var(--v4-mist); }
.mh-no {
  position: relative; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #B9C3CF; background: #fff;
  display: grid; place-items: center; font: 700 12px/1 var(--body); color: var(--v4-muted);
}
.mh-txt { display: grid; min-width: 0; line-height: 1.3; }
.mh-txt b { font-size: 14px; font-weight: 700; }
.mh-txt small { font-size: 12px; color: var(--v4-muted); }
.mh-list .is-next button { background: var(--v4-mist); }
.mh-list .is-next .mh-no { border-color: var(--v4-ink); color: var(--v4-ink); }
.mh-list .is-done .mh-no, .mc-check { border: 0; background: var(--v4-red); }
.mh-list .is-done .mh-no::after, .mc-check::after {
  content: ""; position: absolute; left: 50%; top: 46%; width: 10px; height: 5px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translate(-50%, -50%) rotate(-45deg);
}
.mh-list .is-done .mh-txt b { color: var(--v4-ink-2); }
.mh-cta {
  margin-top: 10px; width: 100%; min-height: 50px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px;
  border: 1px solid var(--v4-ink); background: var(--v4-ink); color: #fff; border-radius: 10px; padding: 8px 14px;
  text-align: left; font: inherit; cursor: pointer;
}
.mh-cta:hover { background: var(--v4-ink-hover); border-color: var(--v4-ink-hover); }
.mh-cta small { grid-column: 1; font-size: 11.5px; font-weight: 600; color: #C9D1DB; }
.mh-cta b { grid-column: 1; font-size: 15px; font-weight: 700; line-height: 1.3; }
.mh-cta span { grid-column: 2; grid-row: 1 / 3; font-size: 18px; }
.mh-cta.is-reward { background: var(--v4-red); border-color: var(--v4-red); }
.mh-cta.is-reward small { color: #FBEDEE; }
.mh-cta.is-reward:hover { background: #9E1B25; border-color: #9E1B25; }
.mission-hub.is-folded .mh-list { display: none; }
.mission-hub.is-folded .mh-bar { margin-bottom: 0; }

/* 쿠폰 창 HUD 도장: 번호가 보이는 동그라미(받으면 빨강 ✓) */
.stamp { color: var(--v4-muted); font: 700 10px/1 var(--body); display: grid; place-items: center; }
.stamp.on { font-size: 0; color: transparent; }
.stamp.on::after { font-size: 11px; color: #fff; }

/* ── 3) 미션 존 맨 위 미션 카드(.stamp-hint 자리) ── */
.stamp-hint.mission-card {
  display: block; margin: 12px 0 8px; padding: 14px 16px 14px; border-radius: 16px;
  background: var(--v4-mist); border: 1px solid var(--v4-line); color: var(--v4-ink); font-size: 14px;
}
.stamp-hint.mission-card[hidden] { display: none; }
.mission-card p { margin: 0; }
.mission-card .mc-top { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 8px; }
.mission-card .mc-step { font: 800 12px/1 var(--body); letter-spacing: .02em; color: var(--v4-red); }
.mission-card .mc-goal { flex: 1 1 auto; font-family: var(--serif); font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--v4-ink); }
.mission-card .mc-state {
  flex: none; font: 700 11.5px/1 var(--body); padding: 5px 9px; border-radius: 999px;
  background: #fff; border: 1px solid var(--v4-line); color: var(--v4-ink-2);
}
.mission-card.is-done .mc-state { background: var(--v4-ink); border-color: var(--v4-ink); color: #fff; }
.mission-card .mc-point { line-height: 1.65; margin-bottom: 10px; word-break: keep-all; }
.mission-card .mc-point b { display: block; font-size: 12px; font-weight: 800; color: var(--v4-muted); margin-bottom: 2px; }
.mission-card .mc-task { background: #fff; border: 1px solid var(--v4-line); border-radius: 10px; padding: 10px 12px; }
.mission-card .mc-task p { font-size: 13.5px; line-height: 1.55; }
.mission-card .mc-task b { color: var(--v4-red); font-weight: 800; margin-right: 6px; }
.mission-card .mc-prog { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.mission-card .mc-prog small { flex: none; font-weight: 700; font-size: 12.5px; color: var(--v4-ink); }
.mission-card .mc-done { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.mission-card .mc-done p { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.mc-check { position: relative; flex: none; width: 22px; height: 22px; border-radius: 50%; }
.mission-card .mc-next { min-height: 44px; gap: 8px; }

/* ── 4) 강의 견본 영상 ── */
.samples { margin: 16px 0 6px; }
.samples[hidden] { display: none; }
.samples h3 { margin: 0 0 2px; }
.samples-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.sample { margin: 0; min-width: 0; }
.sample.is-wide, .sample.is-playing { grid-column: 1 / -1; }
.sample-open {
  position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; overflow: hidden;
  background: var(--v4-ink); color: #fff; text-align: left; font: inherit; cursor: pointer;
}
.sample.is-wide .sample-open img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .3s; }
.sample.is-wide .sample-open:hover img { transform: scale(1.02); }
.sample-btn {
  position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--v4-ink); border-radius: 10px; padding: 9px 13px; font: 700 13.5px/1 var(--body); box-shadow: var(--v4-float);
}
.sample-btn i { width: 0; height: 0; border-left: 10px solid var(--v4-red); border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.sample figcaption { margin-top: 8px; display: grid; gap: 3px; font-size: 13px; line-height: 1.5; color: var(--v4-muted); }
.sample figcaption b { font-size: 14.5px; color: var(--v4-ink); }
.sample-topic { font: 700 11.5px/1.3 var(--body); color: var(--v4-red); }
.sample-card { min-height: 196px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px 14px 12px; }
.sample-card .sample-topic { color: #C9D1DB; }
.sample-card b { font-family: var(--serif); font-size: 15.5px; line-height: 1.5; font-weight: 700; color: #fff; word-break: keep-all; }
.sample-card .sample-btn { position: static; align-self: flex-start; padding: 8px 11px; }
.sample-card:hover { background: var(--v4-ink-hover); }
.sample.is-short figcaption { font-size: 12.5px; }
.sample-player video { display: block; width: 100%; border-radius: 12px; background: #000; }
.sample.is-wide .sample-player video { aspect-ratio: 16 / 9; }
.sample.is-short .sample-player { display: flex; justify-content: center; background: var(--v4-ink); border-radius: 12px; }
.sample.is-short .sample-player video { width: auto; max-width: 100%; height: min(64vh, 560px); aspect-ratio: 9 / 16; }
.sample-open:focus-visible { outline: 3px solid var(--v4-ink); outline-offset: 3px; box-shadow: 0 0 0 3px #fff; }

/* ── 5) 쿠폰 창: 상태별(잠김 is-locked / 신청 is-ready / 발급 is-issued) ── */
.kit.coupon[open] { display: flex; flex-direction: column; }
.kit.coupon > * { flex: none; }
.kit.coupon > img { order: 0; } .kit.coupon > h2 { order: 1; } .kit.coupon .coupon-ticket { order: 3; }
.kit.coupon .coupon-progress { order: 4; } .kit.coupon .coupon-application { order: 5; } .kit.coupon .coupon-application-status { order: 6; }
.kit.coupon .coupon-next { order: 7; } .kit.coupon > .zone-cta { order: 8; } .kit.coupon .coupon-more { order: 9; } .kit.coupon .coupon-bonus { order: 10; }
/* 잠김: 해야 할 일(미션 목록)이 먼저, 교환권은 아래에 작게 */
.kit.coupon.is-locked .coupon-progress { order: 2; }
.kit.coupon.is-locked .coupon-code, .kit.coupon.is-locked .cp-policy, .kit.coupon.is-locked > .zone-cta { display: none; }
.kit.coupon.is-locked .coupon-pct b { font-size: 44px; }
.kit.coupon.is-locked > img { width: 64px; }
.kit.coupon:not(.is-locked) .coupon-progress { display: none; }
.kit.coupon.is-ready .coupon-code { display: none; }
.coupon-valid { white-space: pre-line; }
.kit.coupon .coupon-progress { margin: 10px 0; }
.cp-missions li.is-next { border-color: var(--v4-ink); }
.cp-missions button { grid-template-columns: 22px 1fr auto; align-items: center; min-height: 44px; }
.cp-missions button > span { grid-row: 1 / 3; }
.cp-missions b { font-size: 13px; color: var(--v4-ink); }
.cp-missions b em { font-style: normal; font-weight: 600; color: var(--v4-muted); font-size: 12px; margin-left: 4px; }
.cp-missions small { grid-column: 2; }
.cp-go { grid-column: 3; grid-row: 1 / 3; font: 700 12px var(--body); font-style: normal; color: var(--v4-ink); white-space: nowrap; }
.cp-missions .done .cp-go { display: none; }
.cp-stamprow { list-style: none; display: flex; justify-content: center; gap: 6px; margin: 0 0 10px; padding: 0; }
.cp-stamprow li { flex: 1 1 0; max-width: 74px; display: grid; justify-items: center; gap: 4px; }
.cp-stamprow i {
  position: relative; width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed #B9C3CF; background: #fff;
  display: grid; place-items: center; font: 700 12px/1 var(--body); font-style: normal; color: var(--v4-muted);
}
.cp-stamprow li.on i { border: 0; background: var(--v4-red); }
.cp-stamprow li.on i::after {
  content: ""; position: absolute; left: 50%; top: 46%; width: 11px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translate(-50%, -50%) rotate(-45deg);
}
.cp-stamprow small { font: 600 10.5px/1.3 var(--body); color: var(--v4-muted); text-align: center; word-break: keep-all; }
.kit.coupon.is-issued .cp-stamprow small, .kit.coupon.is-expired .cp-stamprow small { display: none; }
.kit.coupon.is-issued .cp-stamprow i, .kit.coupon.is-expired .cp-stamprow i { width: 22px; height: 22px; }
.kit.coupon.is-issued .cp-stamprow { gap: 4px; margin-bottom: 4px; }
.coupon-next { text-align: left; margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--v4-mist); }
.coupon-next[hidden] { display: none; }
.coupon-next h3 { margin: 0 0 6px; font: 800 13px var(--body); color: var(--v4-ink); }
.coupon-next-steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--v4-ink-2); }
.kit.coupon > .zone-cta { display: grid; justify-content: stretch; gap: 8px; margin-top: 12px; }
.kit.coupon > .zone-cta .btn { width: 100%; justify-content: center; min-height: 48px; }
#coupon-to-chat[hidden] { display: none; }

/* 다섯째 도장 직후(한 번): 도장 다섯 개가 차례로 찍힌다 · 발급 순간: 교환권이 떠오르고 번호가 잠깐 빨강 옅은 바탕 */
@keyframes mStampIn { 0% { transform: scale(1.9) rotate(-14deg); opacity: 0; } 70% { transform: scale(.94); opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes mRise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes mCode { 0%, 40% { background: var(--v4-red-soft); border-color: var(--v4-red); } 100% { background: #fff; } }
.kit.coupon.is-celebrating .cp-stamprow li.on i { animation: mStampIn .5s cubic-bezier(.3, 1.5, .5, 1) both; animation-delay: calc(var(--i) * 140ms + 150ms); }
.kit.coupon.is-celebrating .coupon-pct { animation: mRise .5s ease-out .95s both; }
.kit.coupon.just-issued .coupon-ticket { animation: mRise .55s cubic-bezier(.2, .9, .25, 1) both; }
.kit.coupon.just-issued .coupon-code code { animation: mCode 1.8s ease-out both; }

/* 데스크톱 알림은 안내판(왼쪽 위 308px) 오른쪽 빈 곳 가운데로 — 안내판과 겹치지 않게 */
@media (min-width: 1181px) {
  body.has-mission-hub .toasts { left: calc(326px + (100% - 326px) / 2); max-width: calc(100% - 352px); }
  body.has-mission-hub.panel-open .toasts { left: calc(326px + (100% - var(--panel-w) - 36px - 326px) / 2); max-width: calc(100% - var(--panel-w) - 36px - 346px); }
}
/* 알림의 '다음 미션' 버튼 */
.toast button { min-height: 36px; padding: 6px 12px; white-space: nowrap; }

/* ── 6) 모드 버튼 짧은 이름 · 390px HUD 한 줄 · 모바일 안내판 ── */
#mode-btn .sh { display: none; }
@media (min-width: 761px) and (max-width: 1024px) {
  .mission-hub { width: 260px; left: 12px; }
}
@media (max-width: 760px) {
  .hud { flex-wrap: nowrap; }
  .hud .chat-btn { display: none; }               /* 상담은 오른쪽 아래 두런이 버튼·아래 바 '상담'으로 */
  #mode-btn .lg { display: none; }
  #mode-btn .sh { display: inline; }
  .npc-chip-next { display: none; }               /* 병아리 성장 칩은 데스크톱에서만(모바일은 섬 미션 한 줄이 우선) */

  .intro { padding: 18px 16px 14px; max-height: calc(100dvh - 24px); }
  .intro-duron { display: none; }
  .intro-eyebrow { padding-right: 0; margin-bottom: 10px; font-size: 12px; }
  .intro h2 { font-size: 21px; padding-right: 0; margin-bottom: 8px; }
  .intro-desc { font-size: 14px; margin-bottom: 10px; }
  .intro-missions { margin-bottom: 10px; }
  .intro-missions li { padding: 6px 0; font-size: 14px; gap: 8px; }
  .intro-missions small { font-size: 12px; }
  .intro-meta { margin-bottom: 12px; }
  .intro-meta li { font-size: 12px; padding: 6px 9px; }
  .intro .intro-actions .btn-main { flex: 1 1 auto; min-width: 0; }
  .intro-trust { margin-top: 10px; padding-top: 8px; font-size: 12px; }

  /* 모바일 안내판: HUD 아래 한 줄(도장 다섯 칸 + 다음 미션 버튼). 오른쪽 소리 버튼(44px) 자리는 비운다 */
  .mission-hub, .mission-hub:not([hidden]) {
    left: 10px; right: 64px; width: auto; top: calc(max(10px, env(safe-area-inset-top)) + 52px);
    flex-direction: row; align-items: stretch; gap: 0; padding: 0; border-radius: 12px; overflow: hidden;
  }
  .mission-hub .mh-head, .mission-hub .mh-list { display: none; }
  .mission-hub .mh-bar { flex: none; width: 58px; margin: 0; padding: 0 10px; grid-template-columns: repeat(5, 1fr); gap: 3px; align-content: center; }
  .mission-hub .mh-bar i { height: 6px; }
  .mission-hub .mh-cta { margin: 0; flex: 1 1 auto; min-width: 0; min-height: 46px; border-radius: 0; padding: 5px 12px; }
  .mission-hub .mh-cta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mission-hub .mh-cta small { font-size: 11px; }
  /* 모바일 패널(아래 시트)이 열리면 패널 안 미션 카드가 같은 일을 하므로 안내판은 숨기고 알림은 원래 자리로 */
  body.wchat-open .mission-hub, body.panel-open .mission-hub { opacity: 0; visibility: hidden; pointer-events: none; }
  body.has-mission-hub .toasts { top: 112px; }
  body.has-mission-hub.panel-open .toasts { top: 62px; }

  .samples-grid { grid-template-columns: 1fr; }
  .sample-card { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sample-card .sample-topic { flex: 1 0 100%; }
  .sample-card b { flex: 1 1 0; font-size: 15px; }
  .sample.is-short .sample-player video { height: min(62vh, 520px); }

  .cp-stamprow small { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .kit.coupon.is-celebrating .cp-stamprow li.on i, .kit.coupon.is-celebrating .coupon-pct,
  .kit.coupon.just-issued .coupon-ticket, .kit.coupon.just-issued .coupon-code code { animation: none; }
  .sample.is-wide .sample-open img, .mh-bar i, .mission-hub { transition: none; }
  .sample.is-wide .sample-open:hover img { transform: none; }
}
