/* HUD */
#hud {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 2px 6px;
}
.hudChip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--paper);
  border-radius: 999px;
  padding: 4px 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
}
.hudChip .ico { font-size: 15px; }
.hudChip .ico img { height: 18px; vertical-align: middle; display: block; }
.hudChip small { color: var(--ink-soft); font-size: 10px; min-width: 34px; }
.hudChip.tappable { cursor: pointer; }
.hudChip .plus {
  font-size: 10px; font-weight: 900; color: #fff;
  background: var(--teal); border-radius: 50%;
  width: 15px; height: 15px; line-height: 15px; text-align: center;
}
.hudChip.lvl { margin-left: auto; flex-direction: column; gap: 2px; padding: 4px 12px; }
.hudChip.lvl b { font-size: 12px; }
.xpBar { width: 56px; height: 5px; border-radius: 3px; background: #d9c7a4; overflow: hidden; }
#xpFill { height: 100%; width: 0%; background: var(--teal); border-radius: 3px; transition: width .3s; }
#btnSettings { padding: 4px 9px; }

/* FTUE 코치 배너 — 보드 바로 위, 얇게 (M2c) */
#coachBanner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 6px 8px 6px 12px;
  margin: 0 2px 6px;
}
#coachBanner .ico { font-size: 16px; }
#coachBanner img.ico { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
#coachBanner .txt { flex: 1; font-size: 12px; font-weight: 700; color: var(--ink); }
#coachBanner .skip {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(69, 55, 36, .08);
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
}

/* 의뢰 스트립 */
#orders {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 8px;
  scrollbar-width: none;
}
#orders::-webkit-scrollbar { display: none; }

/* 납품 흡수 완료 플래시 — 카드 위로 은은한 금빛이 한 번 지나감 (#eventOrders도 공유) */
@keyframes deliverFlash {
  0% { box-shadow: inset 0 0 0 0 rgba(212, 165, 49, 0); }
  35% { box-shadow: inset 0 0 24px 4px rgba(212, 165, 49, .55); }
  100% { box-shadow: inset 0 0 0 0 rgba(212, 165, 49, 0); }
}
#orders.deliverFlash, #eventOrders.deliverFlash { animation: deliverFlash .5s ease-out; }
@media (prefers-reduced-motion: reduce) {
  #orders.deliverFlash, #eventOrders.deliverFlash { animation: none; }
}

.orderCard {
  flex: 0 0 auto;
  width: 148px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 9px 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.orderCard.arc { background: linear-gradient(150deg, #f3e3c2, #ecd6a9); border: 1.5px solid var(--gold-soft); }
/* 단골 오더 (M4 §2) — 아크 금테보다 옅은 스타일로 구분 */
.orderCard.regular { background: linear-gradient(150deg, #f8f0dc, #f2e6c9); border: 1px solid #e2cd94; }
.orderCard.primaryArc {
  box-shadow: 0 0 0 1px rgba(168, 127, 34, .15), var(--shadow);
}
.orderCard.primaryArc .arcHead {
  gap: 5px;
  align-items: flex-start;
}
.orderCard.primaryArc .arcTitle {
  flex: 1;
  min-width: 0;
  line-height: 1.15;
}
.orderCard.primaryArc .arcProgress {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .46);
  color: #6e5315;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
}
.orderCard.primaryArc .arcStatus {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.orderCard.primaryArc .oLine {
  min-height: 0;
  color: var(--ink);
  font-size: 10px;
}
.regBadge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  color: #8a6d2f;
  background: #f1e0ad;
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
}
.orderCard .oHead { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.orderCard .oHead .big { font-size: 20px; }
.orderCard .oHead img.portrait {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--gold-soft);
  background: #fff8ea;
  flex: 0 0 auto;
}
.orderCard .oHead img.objArt { width: 24px; height: 24px; object-fit: contain; vertical-align: middle; }
.orderCard .oLine { font-size: 10.5px; color: var(--ink-soft); line-height: 1.35; min-height: 28px; }
.reqRow { display: flex; gap: 3px; flex-wrap: wrap; align-items: center; }
.reqChip {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
  background: #fff8ea;
  border-radius: 999px;
  padding: 3px 7px 3px 6px;
  border: 1px solid #d9c7a4;
  color: var(--ink-soft);
  min-height: 24px;
  line-height: 1;
  touch-action: manipulation;
  box-shadow: 0 1px 0 rgba(168, 127, 34, .12);
  cursor: pointer;
}
.reqChip.have { border-color: #75a3a4; color: var(--ink); background: #eaf3f0; }
.reqChip.missing { background: #fff3e0; border-color: #ddc59b; }
/* 요구 칩 아이템 얼굴 — 보드 스프라이트와 동일 아트 (이모지 폴백은 텍스트로 그대로) */
.reqChip img.itemArt { width: 16px; height: 16px; object-fit: contain; }
.reqChip .reqCount {
  padding-left: 1px;
  font-size: 10px;
  letter-spacing: 0;
}
.reqChip:active:not(:disabled) {
  transform: translateY(1px);
}
.reqChip:focus-visible {
  outline: 2px solid rgba(95, 138, 139, .45);
  outline-offset: 1px;
}
.oBtn {
  background: var(--wood);
  color: #fff7e8;
  font-size: 12.5px;
  font-weight: 800;
  border-radius: 10px;
  padding: 6px 0;
  box-shadow: 0 2px 0 var(--wood-dark);
}
.oBtn.gold { background: var(--gold); box-shadow: 0 2px 0 #a87f22; color: #4a3705; }
.oBtn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }

/* 하단 독 — 2단: 정보 패널(전폭) / 버튼 줄. 한 줄 배치는 좁은 폰에서 정보 패널이 짓눌림 */
#dock {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 2px 10px;
}
.dockBtns { justify-content: space-around; }
#itemInfo {
  flex: 1;
  min-width: 0; /* flex 자식 축소 허용 — 없으면 좁은 화면에서 글자가 1자씩 세로로 꺾임 */
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: 52px; /* 고정 — 내용이 패널을 세로로 부풀려 보드를 덮는 것 방지 */
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  overflow: hidden;
}
#itemInfo.empty { color: var(--ink-soft); font-size: 12px; }
/* 정보 패널 아이템/제너레이터 얼굴 — 보드와 동일 아트, 이모지 폴백 시 22px 유지 */
#itemInfo .infoFace { font-size: 22px; flex-shrink: 0; display: flex; align-items: center; }
#itemInfo .infoFace img { width: 30px; height: 30px; object-fit: contain; }
#itemInfo .info { flex: 1; min-width: 0; overflow: hidden; }
#itemInfo .name,
#itemInfo .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#itemInfo .name { font-weight: 800; }
#itemInfo .sub { font-size: 11px; color: var(--ink-soft); }
#itemInfo .actions { flex-shrink: 0; display: flex; gap: 5px; }
#itemInfo .actions button {
  background: var(--teal);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  border-radius: 9px;
  padding: 7px 8px;
  white-space: nowrap;
}
#itemInfo .actions button.sell { background: var(--wood); }
#itemInfo .actions button.confirm { background: var(--danger); }
.dockBtns { display: flex; gap: 6px; }
.dockBtn {
  width: 46px; height: 52px;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.dockBtn small { font-size: 9px; font-weight: 700; color: var(--ink-soft); }
.dockBtn img { width: 24px; height: 24px; object-fit: contain; }
.dockBtn .dot {
  position: absolute; top: 4px; right: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger);
}

/* 모달 */
#modalRoot:empty { display: none; }
.modalVeil {
  position: fixed; inset: 0;
  background: rgba(43, 32, 18, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modalCard {
  width: min(400px, 94vw);
  max-height: 84vh; /* dvh 미지원 WebView 폴백 — 카드가 화면을 뚫는 문제 방지 */
  max-height: 84dvh;
  overflow-y: auto;
  background: linear-gradient(165deg, #fbf2df, var(--paper));
  border: 2px solid var(--gold-soft);
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  padding: 20px 18px 16px;
  text-align: center;
}

/* 모달 닫기 X — 리스트형 모달만(dismissible). sticky+height:0으로 스크롤해도 항상 보이되 콘텐츠는 밀지 않음 */
.modalCloseWrap {
  position: sticky;
  top: 0;
  height: 0;
  overflow: visible;
  text-align: right;
  z-index: 5;
  margin: -6px -10px 0 0;
}
.modalClose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(43, 32, 18, .12);
  color: var(--ink-soft);
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}
.modalClose:active { background: rgba(43, 32, 18, .22); }
.modalCard h2 { font-size: 17px; margin-bottom: 10px; }
.modalCard .big { font-size: 52px; line-height: 1.2; }
/* 모달 헤더 아트 (bigArt) — 매니페스트 실물 있을 때 이모지 대신 표시, 절제된 크기로 석판 느낌 유지 */
.modalCard .big img.bigArt { width: 96px; height: 96px; object-fit: contain; border-radius: 14px; vertical-align: middle; }
.modalCard .big img.bigArt-chars { width: 110px; height: 110px; border-radius: 50%; }
.modalCard .big img.bigArt-vignette { width: 150px; height: 150px; }
.modalCard p { font-size: 13px; line-height: 1.65; color: var(--ink-soft); white-space: pre-line; text-align: left; margin: 10px 4px; }
.modalCard p img.objArt { width: 36px; height: 36px; object-fit: contain; vertical-align: middle; }
.modalCard p.center { text-align: center; }
.rewardRow { display: flex; justify-content: center; gap: 10px; font-weight: 800; font-size: 14px; margin: 10px 0 4px; }
.modalBtn {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: var(--gold);
  color: #4a3705;
  font-weight: 800;
  font-size: 14px;
  padding: 11px 0;
  border-radius: 12px;
  box-shadow: 0 2px 0 #a87f22;
}
.modalBtn.sub { background: var(--paper); color: var(--ink-soft); box-shadow: 0 2px 0 #cbb68f; }
.modalBtn:disabled { filter: grayscale(.5); }
.modalBtn small { display: block; font-weight: 600; font-size: 10px; opacity: .75; }

/* 회상 장면 — 감정 표면: 과금 UI 금지 (synopsis §10) */
/* 킨츠기 회상: 금이음 선이 천천히 그어진다 */
.goldSeam {
  height: 3px;
  width: 0;
  margin: 10px auto 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #b08d3e, var(--gold) 45%, #f4dc9a 55%, var(--gold));
  box-shadow: 0 0 10px rgba(212, 165, 49, .8);
  animation: seamDraw 1.4s ease-out .4s forwards;
}
@keyframes seamDraw { to { width: 82%; } }
.vignette .big { filter: drop-shadow(0 0 18px #d4a53199); }
.vignette h2 { color: var(--wood-dark); }
@keyframes vigGlow { 0% { box-shadow: 0 0 0 rgba(212,165,49,0); } 100% { box-shadow: 0 0 60px rgba(212,165,49,.45); } }
.vignette { animation: vigGlow 1.6s ease-out forwards; }

/* 일지 (데일리+미션) */
.journalRow {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff8ea;
  border: 1.5px solid #e2d2ae;
  border-radius: 12px;
  padding: 9px 10px;
  margin: 7px 0;
  text-align: left;
}
.journalRow .jLabel { flex: 1; font-size: 12.5px; font-weight: 700; }
/* 복원 모달 공간 미리보기 썸네일 */
.journalRow .spaceThumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.journalRow .jLabel small { display: block; font-weight: 600; font-size: 10.5px; color: var(--ink-soft); margin-top: 2px; }
.jBar { height: 5px; border-radius: 3px; background: #e6d7b4; overflow: hidden; margin-top: 4px; }
.jBar div { height: 100%; background: var(--teal); border-radius: 3px; }
.jBtn {
  background: var(--gold);
  color: #4a3705;
  font-size: 12px;
  font-weight: 800;
  border-radius: 9px;
  padding: 7px 12px;
  box-shadow: 0 2px 0 #a87f22;
  white-space: nowrap;
}
.jBtn.done { background: #d8c9a5; box-shadow: none; color: var(--ink-soft); }
.jBtn.danger, .modalBtn.danger { background: var(--danger); color: #fff; box-shadow: 0 2px 0 #7e3d27; }
.dailyDots { display: flex; justify-content: center; gap: 5px; margin: 6px 0 2px; }
.dailyDots span { width: 9px; height: 9px; border-radius: 50%; background: #ddcba1; }
.dailyDots span.on { background: var(--gold); box-shadow: 0 0 5px #d4a53188; }

/* 도감 */
.codexChain { text-align: left; margin: 10px 0; }
.codexChain h3 { font-size: 13px; margin-bottom: 5px; }
.codexRow { display: flex; flex-wrap: wrap; gap: 4px; }
.codexChip {
  width: 44px; height: 44px;
  border-radius: 9px;
  background: #fff8ea;
  border: 1.5px solid #e2d2ae;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}
.codexChip img { width: 84%; height: 84%; object-fit: contain; }
.codexChip.unknown { color: #b9a67e; font-weight: 800; font-size: 16px; background: #f2e7cd; }
/* 슬롯 확장 '＋' 칩 — 빈 슬롯(unknown)과 시각 구분 */
.codexChip.slotAdd { border: 1.5px dashed var(--gold); background: #fdf6e3; color: #a87f22; }
/* 창고 2단계 꺼내기 — 1탭 선택 상태 강조 */
.codexChip.selected { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(95, 138, 139, .35) inset; }
.codexChip .t {
  position: absolute; right: 1px; bottom: 0;
  font-size: 9px; font-weight: 800; color: #fff;
  background: var(--wood); border-radius: 5px 0 5px 0; padding: 0 3px; line-height: 12px;
}

/* 토스트 */
#toastRoot { position: fixed; top: 12px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 200; pointer-events: none; }
.toast {
  background: rgba(59, 45, 27, .92);
  color: #ffeeca;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease-out, toastOut .4s ease-in 1.8s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }
