/* 퀘스트 안내(2026-10-11, js/quest.js): 미션 카드 · 목표 화살표 · 장소 창 '지금 할 일' 막대 · 할 일 자리 빛내기 */
:root { --q-red: #C8202F; --q-red-deep: #9E1B25; --q-ink: #18212B; --q-gold: #FFD257; }

/* 미션 카드: 화면 위쪽 가운데. 첫 미션은 [출발하기] 단추가 있는 튜토리얼 카드 */
.quest-card {
  position: fixed; z-index: 55; left: 50%; top: 92px; transform: translateX(-50%);
  width: min(460px, calc(100vw - 24px));
  display: grid; grid-template-columns: 84px 1fr; gap: 4px 14px; align-items: center;
  padding: 14px 18px 14px 12px; border-radius: 22px;
  background: #fff; color: var(--q-ink); border: 2px solid var(--q-red);
  box-shadow: 0 22px 50px -18px rgba(20, 40, 70, .55);
  animation: qcIn .42s cubic-bezier(.2, 1.3, .4, 1) both;
}
.quest-card[hidden] { display: none; }
.quest-card.is-out { animation: qcOut .26s ease-in both; }
.quest-card img { width: 84px; height: 84px; object-fit: contain; grid-row: 1 / 3; }
.qc-body { min-width: 0; }
.qc-kicker { margin: 0 0 2px; font-size: 13px; font-weight: 800; color: var(--q-red); }
.qc-name { margin: 0; font-family: var(--display, inherit); font-size: 22px; line-height: 1.25; word-break: keep-all; }
.qc-why { margin: 4px 0 0; font-size: 14.5px; line-height: 1.5; color: #44505C; word-break: keep-all; }
.qc-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 12px 0 0; }
.qc-go {
  min-height: 46px; padding: 0 24px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--q-red); color: #fff; font: inherit; font-size: 16px; font-weight: 800;
  box-shadow: 0 6px 0 var(--q-red-deep); animation: qcPulse 1.6s ease-in-out infinite;
}
.qc-go:hover { background: var(--q-red-deep); }
.qc-go:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--q-red-deep); }
.qc-self { border: 0; background: none; padding: 6px 2px; font: inherit; font-size: 13.5px; color: #5A6672; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.qc-tip { margin: 8px 0 0; font-size: 12.5px; color: #6A7682; }
.qc-steps { grid-column: 2; display: flex; gap: 5px; margin-top: 8px; }
.qc-steps i { width: 26px; height: 6px; border-radius: 3px; background: #E3E8EE; }
.qc-steps i.on { background: #2E9C8F; }
.qc-steps i.cur { background: var(--q-red); }
.quest-card:not(.has-btn) { grid-template-columns: 60px 1fr; padding: 10px 16px 10px 10px; }
.quest-card:not(.has-btn) img { width: 60px; height: 60px; }
.quest-card:not(.has-btn) .qc-name { font-size: 19px; }
.quest-card:not(.has-btn) .qc-why { font-size: 13.5px; }
@keyframes qcIn { from { opacity: 0; transform: translate(-50%, -14px) scale(.94); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes qcOut { to { opacity: 0; transform: translate(-50%, -10px) scale(.97); } }
@keyframes qcPulse { 0%, 100% { filter: none; } 50% { filter: brightness(1.12); } }

/* 목표 화살표: 건물 위에 위아래로 통통, 화면 밖이면 가장자리에서 방향을 가리킨다 */
.quest-mark {
  position: fixed; z-index: 24; left: 0; top: 0; margin: 0; padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; justify-items: center; gap: 2px; translate: -50% -100%;
  font: inherit; color: var(--q-ink); will-change: transform;
}
.quest-mark[hidden] { display: none; }
.qm-label {
  white-space: nowrap; padding: 5px 11px; border-radius: 999px; background: var(--q-red); color: #fff;
  font-size: 13.5px; font-weight: 800; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .45);
}
.qm-label small { font-size: 12px; font-weight: 700; opacity: .85; margin-left: 4px; }
.qm-arrow {
  width: 0; height: 0; border-left: 15px solid transparent; border-right: 15px solid transparent; border-top: 20px solid var(--q-red);
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .3)); animation: qmBob 0.9s ease-in-out infinite;
}
.quest-mark.is-edge { translate: -50% -50%; }
.quest-mark.is-edge .qm-arrow { order: -1; rotate: var(--qa, 0deg); animation: none; }
.quest-mark.is-edge { grid-template-areas: "a" "l"; }
.quest-mark:focus-visible .qm-label { outline: 3px solid var(--q-gold); outline-offset: 2px; }
@keyframes qmBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
body.quest-card-open .quest-mark { opacity: .9; }

/* 2D 지도: 목표 핀 강조 */
#map2d .pin.is-quest rect:first-child { stroke: var(--q-red); stroke-width: .6; }
#map2d .pin.is-quest circle { stroke: var(--q-red); stroke-width: .5; opacity: 1; animation: qPin 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes qPin { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
/* 목표 핀도 키보드 초점이 보이게(빨간 강조가 v4 초점 표시를 덮어 초점이 안 보이던 것, 2026-10-11 qa_keyboard) */
#map2d .pin.is-quest:focus-visible rect:first-child { stroke: var(--v4-ink, #172334); stroke-width: .9; }
#map2d .pin.is-quest:focus-visible circle { stroke: var(--v4-ink, #172334); stroke-width: .7; }

/* 장소 창 아래 '지금 할 일' 막대(창 안 맨 아래에 붙어 있음) */
.quest-bar {
  flex: none; display: flex; align-items: center; gap: 10px 14px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) 20px;
  border-top: 2px solid var(--q-red); background: #FFF6F6;
  border-radius: 0 0 var(--r-lg, 22px) 8px;
}
.quest-bar[hidden] { display: none; }
.quest-bar p { flex: 1 1 auto; min-width: 0; margin: 0; display: grid; gap: 2px; }
.quest-bar b { font-size: 15px; line-height: 1.35; word-break: keep-all; color: var(--q-ink); }
.qb-tag { font-size: 12px; font-weight: 800; color: var(--q-red); }
.qb-tag.is-ok { color: #1F7F73; }
.qb-btns { display: flex; gap: 6px; flex: none; }
.qb-btn {
  flex: none; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--q-red); color: #fff; font: inherit; font-size: 14.5px; font-weight: 800; white-space: nowrap;
}
.qb-btn:hover { background: var(--q-red-deep); }
.qb-btn.is-sub { background: #fff; color: var(--q-red); box-shadow: inset 0 0 0 2px var(--q-red); }
.qb-btn.is-sub:hover { background: #FDEBEC; }
.qb-btn:focus-visible { outline: 3px solid var(--q-gold); outline-offset: 2px; }

/* 할 일 자리 빛내기 */
.quest-spot { outline: 3px solid var(--q-red); outline-offset: 6px; border-radius: 12px; animation: qSpot 1.2s ease-in-out 4; }
@keyframes qSpot { 0%, 100% { outline-color: var(--q-red); outline-offset: 6px; } 50% { outline-color: rgba(200, 32, 47, .25); outline-offset: 10px; } }

@media (max-width: 760px) {
  .quest-card { top: auto; bottom: calc(86px + env(safe-area-inset-bottom)); grid-template-columns: 64px 1fr; padding: 12px 14px 12px 10px; border-radius: 20px; }
  .quest-card img { width: 64px; height: 64px; }
  .qc-name { font-size: 19px; }
  .qc-why { font-size: 13.5px; }
  .qc-go { flex: 1 1 auto; }
  .quest-card:not(.has-btn) { bottom: auto; top: 116px; }
  .quest-bar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)) 14px; border-radius: 0; }
  .quest-bar b { font-size: 14px; }
  .qb-btn { padding: 0 13px; font-size: 14px; }
  .quest-bar:has(.qb-btns) { flex-wrap: wrap; }
  .quest-bar:has(.qb-btns) .qb-btns { width: 100%; }
  .quest-bar:has(.qb-btns) .qb-btn { flex: 1 1 0; }
  body.quest-card-open .dock { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .quest-card, .quest-card.is-out, .qc-go, .qm-arrow, #map2d .pin.is-quest circle, .quest-spot { animation: none; }
}
.panel-body { flex: 1 1 auto; min-height: 0; }

.mq.is-locked { display: none; }
@media (max-width: 760px) { body.quest-card-open #chick-agent:not(.is-open) { visibility: hidden; } }  /* 상담 창이 열려 있으면 숨기지 않는다 */
.qc-walk { font-size: 13.5px; font-weight: 700; color: #1F7F73; }
.qb-link { justify-self: start; margin-top: 2px; padding: 2px 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--q-ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
/* 2D 지도(PC): 카드가 위쪽 목표 건물·화살표를 덮지 않게 아래쪽 가운데(바로가기 바 위)에 둔다 */
@media (min-width: 761px) { body.mode-2d .quest-card { top: auto; bottom: 104px; } }
/* 2D: 목표 핀이 아래쪽이면 카드는 위쪽에(quest.js가 at-top을 붙임, 2026-10-11) */
body.mode-2d .quest-card.at-top { top: 92px; bottom: auto; }
@media (max-width: 760px) { body.mode-2d .quest-card.at-top { top: 116px; bottom: auto; } }
