/* ====================================================================
   춘천, 한 장의 답장 — UI 스타일
   색: 크림 #fff2d8 / 닭갈비 오렌지 #e8894f / 숲 #75a87d
       호수 #6fb7c8 / 네이비 #24323a / 강조그린 #2e7d6b
   ==================================================================== */
* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: #24323a;
  background: #cfe6e0;
  -webkit-user-select: none; user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* 공용 덮개 */
.screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(24, 40, 44, 0.5);
  backdrop-filter: blur(4px);
  z-index: 30;
  overflow-y: auto; overscroll-behavior: contain;
}

/* ===== 로딩 ===== */
#loading { background: linear-gradient(160deg, #8ec7e6, #fef0d9); z-index: 60; }
.loading-emoji { font-size: 72px; animation: floaty 1.6s ease-in-out infinite; }
.loading-text { margin-top: 14px; font-size: 18px; font-weight: 700; color: #2e7d6b; }
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-12px)} }

/* ===== 공용 버튼 ===== */
.big-btn {
  display: block; width: 100%; padding: 14px;
  border: 0; border-radius: 14px;
  background: #e8894f; color: #fff;
  font-size: 17px; font-weight: 800; cursor: pointer;
  box-shadow: 0 6px 16px rgba(232,137,79,0.4);
  transition: transform .08s, background .15s;
}
.big-btn:hover { background: #df7637; }
.big-btn:active { transform: scale(.98); }
.text-btn {
  margin-top: 12px; background: none; border: 0;
  color: #8a948f; font-size: 13px; cursor: pointer; text-decoration: underline;
}

/* ====================================================================
   오프닝 시네마틱
   ==================================================================== */
.cinematic { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.cine-bars { position: fixed; left: 0; right: 0; height: 11vh; background: #0c0f0e; z-index: 51;
  animation: barsIn .8s ease forwards; }
.cine-bars.top { top: 0; }
.cine-bars.bottom { bottom: 0; }
@keyframes barsIn { from{height:0} to{height:11vh} }

.cine-subtitle {
  position: fixed; left: 50%; bottom: 15vh; transform: translateX(-50%);
  width: min(86%, 760px); text-align: center;
  color: #fff; font-size: clamp(17px, 2.6vw, 26px); font-weight: 700;
  line-height: 1.6; text-shadow: 0 2px 10px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .6s; z-index: 52;
}
.skip-btn {
  position: fixed; right: 22px; bottom: 13.5vh;
  pointer-events: auto; z-index: 53;
  padding: 8px 16px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.85); color: #24323a;
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.skip-btn:hover { background: #fff; }

.cine-title {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; z-index: 52;
  animation: titleIn 1.4s ease forwards;
}
.cine-title-sub { color: #ffd7a8; letter-spacing: 3px; font-weight: 700; margin-bottom: 8px; }
.cine-title h1 {
  margin: 0; color: #fff; font-size: clamp(34px, 8vw, 74px); font-weight: 900;
  text-shadow: 0 4px 24px rgba(0,0,0,.6); letter-spacing: 2px;
}
@keyframes titleIn { from{opacity:0; transform:translateY(20px)} to{opacity:1; transform:translateY(0)} }

/* ====================================================================
   메인 메뉴
   ==================================================================== */
.menu {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center;
  justify-content: flex-start;
  padding: 6vw;
  background: linear-gradient(90deg, rgba(20,38,42,.55) 0%, rgba(20,38,42,.15) 48%, transparent 72%);
}
.menu-panel { max-width: 460px; animation: menuIn .8s ease; }
@keyframes menuIn { from{opacity:0; transform:translateX(-24px)} to{opacity:1; transform:translateX(0)} }
.menu-tag { color: #ffe0b0; letter-spacing: 4px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.menu-title {
  margin: 8px 0 14px; color: #fff; font-size: clamp(40px, 7vw, 68px);
  font-weight: 900; line-height: 1.05; text-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.menu-desc { color: #f1f6f2; line-height: 1.7; margin: 0 0 28px; font-size: 15px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; max-width: 300px; }
.menu-btn {
  padding: 13px 18px; border: 0; border-radius: 13px;
  background: rgba(255,255,255,.92); color: #24323a;
  font-size: 15px; font-weight: 700; cursor: pointer; text-align: left;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  transition: transform .08s, background .15s;
}
.menu-btn:hover { background: #fff; transform: translateX(4px); }
.menu-btn.primary { background: #e8894f; color: #fff; }
.menu-btn.primary:hover { background: #df7637; }
.menu-btn.danger { background: #f3dede; color: #c0392b; text-align: center; }
.menu-foot { margin-top: 22px; color: #e6eeec; font-size: 12px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }

/* ====================================================================
   인게임 HUD
   ==================================================================== */
.hud { position: fixed; z-index: 15; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.55); }
#hud-top-left { top: 16px; left: 16px; }
.game-title { font-size: 17px; font-weight: 800; opacity: .92; }
.current-location {
  margin-top: 6px; display: inline-block;
  background: rgba(46,125,107,.9); padding: 5px 14px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
}

#hud-top-right { top: 16px; right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.progress-wrap {
  background: rgba(36,50,58,.6); padding: 8px 14px; border-radius: 14px; text-align: center;
}
.progress-label { font-size: 11px; opacity: .85; }
.progress-count { font-size: 20px; font-weight: 900; }
.hud-btn-row { display: flex; gap: 6px; }
.hud-btn {
  width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.9); color: #2e7d6b;
  font-size: 18px; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.2);
}
.hud-btn:hover { background: #fff; }

#hud-bottom {
  bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(36,50,58,.55); padding: 9px 16px; border-radius: 999px;
  font-size: 13px; white-space: nowrap;
}
.key {
  display: inline-block; background: rgba(255,255,255,.92); color: #24323a;
  padding: 2px 8px; border-radius: 6px; font-weight: 800; font-size: 12px;
  margin: 0 4px 0 12px; text-shadow: none;
}
#hud-bottom .key:first-child { margin-left: 0; }

/* 상호작용 힌트 */
.interact-hint {
  position: fixed; z-index: 16; bottom: 74px; left: 50%; transform: translateX(-50%);
  background: rgba(232,137,79,.95); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-weight: 800; box-shadow: 0 6px 18px rgba(0,0,0,.3);
  animation: bob 1.1s ease-in-out infinite;
}
.interact-hint .key { background: rgba(255,255,255,.95); color: #e8894f; }
@keyframes bob { 0%,100%{transform:translate(-50%,0)} 50%{transform:translate(-50%,-7px)} }

/* 토스트 */
.toast {
  position: fixed; z-index: 25; top: 92px; left: 50%; transform: translate(-50%,-10px);
  background: rgba(36,50,58,.92); color: #fff; padding: 12px 22px; border-radius: 14px;
  font-weight: 700; font-size: 14px; max-width: 86%; text-align: center;
  opacity: 0; transition: opacity .4s, transform .4s; box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.toast.show { opacity: 1; transform: translate(-50%,0); }

/* ====================================================================
   NPC 대화창
   ==================================================================== */
.dialogue { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 0 16px 24px; }
.dia-box {
  width: min(100%, 680px);
  background: #fff8ec; border: 3px solid #2e7d6b; border-radius: 20px;
  padding: 18px 22px; box-shadow: 0 -6px 30px rgba(0,0,0,.3);
  animation: diaIn .35s ease;
  display: flex; gap: 16px; align-items: stretch;
}
@keyframes diaIn { from{opacity:0; transform:translateY(24px)} to{opacity:1; transform:translateY(0)} }
.dia-portrait {
  position: relative; flex-shrink: 0; width: 92px; height: 92px;
  border-radius: 16px; overflow: hidden; background: #e7f2ee;
  border: 2px solid #2e7d6b; align-self: center;
}
.dia-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dia-emoji-badge { position: absolute; right: 2px; bottom: 2px; font-size: 20px; background: rgba(255,255,255,.85); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; }
.dia-content { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.dia-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dia-name { font-weight: 900; color: #2e7d6b; font-size: 16px; }
.dia-line { margin: 0; color: #2e3b38; font-size: 17px; line-height: 1.7; min-height: 52px; }
.dia-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.dia-progress { color: #9aa4a0; font-size: 13px; font-weight: 700; }
.dia-next {
  padding: 10px 20px; border: 0; border-radius: 12px; background: #e8894f; color: #fff;
  font-weight: 800; font-size: 15px; cursor: pointer;
}
.dia-next:hover { background: #df7637; }

/* ====================================================================
   기억 엽서(카드)
   ==================================================================== */
.card-box {
  width: 100%; max-width: 460px; background: #fff8ec;
  border-radius: 24px; padding: 28px; text-align: center;
  box-shadow: 0 16px 44px rgba(0,0,0,.35); max-height: 92vh; overflow-y: auto;
  border: 1px solid #ecd9b8; animation: popIn .4s ease;
}
@keyframes popIn { from{opacity:0; transform:scale(.92)} to{opacity:1; transform:scale(1)} }
.card-emoji { font-size: 56px; }
.card-location {
  display: inline-block; background: #e7f2ee; color: #2e7d6b;
  padding: 3px 13px; border-radius: 999px; font-size: 13px; font-weight: 800; margin: 8px 0;
}
.card-name { margin: 4px 0 12px; color: #24323a; font-size: 22px; }
.card-story { color: #4a5551; line-height: 1.8; text-align: left; font-size: 15px; }

.puzzle-area { margin-top: 20px; padding-top: 18px; border-top: 1px dashed #d8ddd9; }
.puzzle-question { font-weight: 800; color: #24323a; margin-bottom: 14px; }
.puzzle-options { display: flex; flex-direction: column; gap: 10px; }
.opt-btn {
  padding: 12px; border: 2px solid #e2e7e3; border-radius: 12px; background: #fff;
  font-size: 15px; font-weight: 700; color: #2e3b38; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.opt-btn:hover { border-color: #2e7d6b; background: #f3faf7; }
.puzzle-feedback { margin-top: 12px; font-weight: 800; min-height: 20px; }
.puzzle-feedback.good { color: #2e7d6b; }
.puzzle-feedback.bad { color: #d4502e; }
.card-restored { margin-top: 18px; }
.card-info {
  background: #e7f2ee; border-radius: 12px; padding: 14px; color: #2e5c50;
  line-height: 1.6; text-align: left; font-size: 14px; margin-bottom: 16px;
}

/* ====================================================================
   패널 (앨범/지도/설정)
   ==================================================================== */
.panel {
  width: 100%; max-width: 700px; background: #fff8ec; border-radius: 24px;
  padding: 24px; box-shadow: 0 16px 44px rgba(0,0,0,.35);
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin: auto; border: 1px solid #ecd9b8; animation: popIn .35s ease;
}
.panel.narrow { max-width: 420px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h2 { margin: 0; color: #2e7d6b; }
.close-x {
  border: 0; background: #ecf1ef; width: 36px; height: 36px; border-radius: 50%;
  font-size: 16px; cursor: pointer; color: #4a5551;
}
.close-x:hover { background: #dde5e2; }

/* 앨범 */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px,1fr)); gap: 14px; }
.album-cell { border: 3px solid #e2e7e3; border-radius: 16px; padding: 16px; text-align: center; background: #fffdf8; }
.album-cell.locked { opacity: .65; background: #f4f6f5; }
.album-stamp {
  width: 54px; height: 54px; margin: 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  box-shadow: 0 3px 8px rgba(0,0,0,.2); color: #fff;
}
.album-stamp.locked-stamp { background: #cdd4d0; }
/* 장소 스크린샷 사진(엽서 느낌) */
.album-photo { position: relative; width: 100%; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,.2); margin-bottom: 6px; }
.album-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-stamp { position: absolute; right: 6px; bottom: 6px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.3); border: 2px solid #fff8ec; }
.album-section-title { font-weight: 800; color: #2e7d6b; margin: 6px 0 10px; font-size: 15px; }
/* 미션 현황 */
.mission-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.mission-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fffdf8; border: 2px solid #e8eeea; }
.mission-row.done { background: #eef7f1; border-color: #bfe0cf; }
.mission-row.active { background: #fff5ec; border-color: #f2cba8; }
.mission-row.locked { opacity: .7; }
.mission-ic { font-size: 20px; }
.mission-body { flex: 1; color: #2e3b38; font-size: 14px; line-height: 1.3; }
.mission-body small { color: #6a736f; }
.mission-stat { font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: 999px; }
.mission-stat.done { background: #2e7d6b; color: #fff; }
.mission-stat.active { background: #e8894f; color: #fff; }
.mission-stat.locked { background: #d2d8d4; color: #6a736f; }
.album-loc { font-size: 12px; color: #2e7d6b; font-weight: 800; margin-top: 8px; }
.album-title { font-weight: 900; color: #24323a; margin: 4px 0; }
.album-info { font-size: 12px; color: #6a736f; line-height: 1.5; }

/* 지도 */
.map-board {
  position: relative; width: 100%; aspect-ratio: 1/1;
  background:
    radial-gradient(circle at 50% 18%, rgba(111,183,200,.5), transparent 32%),
    linear-gradient(180deg, #dbeed3, #c3e3bb 60%, #b8ddb0);
  border: 3px solid #bcd9b4; border-radius: 16px; overflow: hidden;
}
.map-dot { position: absolute; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.map-dot .map-emoji {
  width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 19px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.map-dot.locked { opacity: .55; }
.map-dot.locked .map-emoji { filter: grayscale(1); }
.map-name {
  font-size: 11px; font-weight: 800; color: #24323a;
  background: rgba(255,255,255,.88); padding: 1px 6px; border-radius: 6px; white-space: nowrap;
}
.map-player { position: absolute; transform: translate(-50%,-50%); font-size: 24px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); z-index: 2; }
.map-hint { text-align: center; color: #6a736f; font-size: 13px; margin: 14px 0 0; }

/* 설정 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 0; }
.set-row label { font-weight: 700; color: #2e3b38; }
.set-row input[type=range] { flex: 1; accent-color: #e8894f; }
.set-divider { height: 1px; background: #e2e7e3; margin: 20px 0; }

/* ====================================================================
   춘천 추천 창
   ==================================================================== */
.reco-guide { color: #4a5551; margin: 0 0 14px; line-height: 1.6; }
.reco-field { margin-bottom: 12px; }
.reco-field label { display: block; font-weight: 800; color: #2e7d6b; font-size: 13px; margin-bottom: 5px; }
.reco-field input, .reco-field select, .reco-field textarea {
  width: 100%; padding: 10px 12px; border: 2px solid #e2e7e3; border-radius: 10px;
  font: inherit; color: #24323a; background: #fff; resize: vertical;
}
.reco-field input:focus, .reco-field select:focus, .reco-field textarea:focus { outline: none; border-color: #2e7d6b; }
.reco-error { color: #c0392b; font-weight: 700; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.reco-locked {
  background: #fff5ec; border: 2px dashed #f2cba8; border-radius: 14px;
  padding: 16px; color: #8a5a3a; line-height: 1.7; text-align: center; font-weight: 600;
}
.reco-divider { height: 1px; background: #e2e7e3; margin: 20px 0 14px; }
.reco-list-head { font-weight: 900; color: #2e7d6b; margin-bottom: 12px; }
.reco-list { display: flex; flex-direction: column; gap: 10px; }
.reco-empty { text-align: center; color: #9aa4a0; padding: 20px; }
.reco-card { background: #fffdf8; border: 2px solid #e8eeea; border-radius: 14px; padding: 12px 14px; }
.reco-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; gap: 8px; }
.reco-place-tag { background: #e7f2ee; color: #2e7d6b; font-weight: 800; font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.reco-time { color: #9aa4a0; font-size: 12px; white-space: nowrap; }
.reco-card-msg { color: #2e3b38; line-height: 1.6; overflow-wrap: anywhere; }
.reco-card-by { color: #6a736f; font-size: 13px; font-weight: 700; margin-top: 6px; text-align: right; }

/* ====================================================================
   엔딩
   ==================================================================== */
.ending-box {
  width: 100%; max-width: 480px; background: #fff8ec; border-radius: 24px;
  padding: 32px 28px; text-align: center; box-shadow: 0 16px 44px rgba(0,0,0,.4);
  border: 1px solid #ecd9b8; animation: popIn .5s ease;
}
.ending-emoji { font-size: 60px; animation: floaty 2s ease-in-out infinite; }
.ending-box h1 { color: #2e7d6b; font-size: 28px; margin: 10px 0 18px; }
.ending-badge {
  display: inline-block; background: #e8894f; color: #fff; font-weight: 800;
  padding: 6px 16px; border-radius: 999px; font-size: 14px; margin-bottom: 6px;
  box-shadow: 0 4px 12px rgba(232,137,79,.4);
}
.ending-btn-row { display: flex; gap: 10px; margin-top: 12px; }
.ending-btn-row .menu-btn { flex: 1; text-align: center; }
.ending-text { color: #4a5551; line-height: 1.8; }
.ending-text.small { font-size: 15px; color: #e8894f; font-weight: 700; margin: 18px 0 20px; }
.ending-postcard {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  margin: 20px 0; padding: 16px; background: #fffdf8; border: 2px dashed #d8c9a8; border-radius: 16px;
}
.pc-cell {
  width: 82px; height: 78px; border-radius: 10px; color: #fff; overflow: hidden; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.2);
}
.pc-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-cell small { position: relative; z-index: 1; font-size: 9px; margin-top: 2px; opacity: .98; background: rgba(0,0,0,.4); padding: 1px 4px; border-radius: 4px; align-self: stretch; text-align: center; margin-top: auto; }
.pc-cell span { font-size: 26px; }

/* ====================================================================
   모바일
   ==================================================================== */
@media (max-width: 560px) {
  #hud-bottom { font-size: 11px; padding: 7px 10px; }
  .key { margin-left: 7px; padding: 2px 6px; }
  .menu { justify-content: center; background: rgba(20,38,42,.55); }
  .menu-panel { text-align: center; }
  .menu-buttons { margin: 0 auto; }
  .game-title { font-size: 15px; }
}
