/* ============================================================
   스마트폰 미션 — 가짜 폰 프레임 + 공용 UI
   (페이지 뼈대는 ../mission/mission.css 재사용)
   ============================================================ */

/* ── 폰 프레임 ── */
.phone {
  max-width: 390px; margin: 0 auto; background: #111827; border-radius: 40px;
  padding: 10px; box-shadow: 0 18px 44px rgba(0,0,0,.28);
  user-select: none;
}
.p-screen {
  background: #F8FAFC; border-radius: 32px; overflow: hidden; position: relative;
  display: flex; flex-direction: column; min-height: 600px;
}
.p-status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px 6px; font-size: .78rem; font-weight: 800; color: #111827;
  background: transparent; flex-shrink: 0;
}
.p-status .ps-right { display: flex; gap: 6px; align-items: center; }
.p-body { flex: 1; position: relative; overflow-y: auto; display: flex; flex-direction: column; }
.p-homebar { height: 5px; width: 120px; background: #CBD5E1; border-radius: 3px; margin: 10px auto; flex-shrink: 0; }

/* ── 홈 화면 ── */
.p-home { flex: 1; padding: 22px 18px; background: linear-gradient(160deg, #DBEAFE, #EDE9FE); }
.p-apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; }
.p-app { display: flex; flex-direction: column; align-items: center; gap: 6px; border: none; background: transparent; cursor: pointer; font-family: inherit; padding: 0; -webkit-tap-highlight-color: transparent; }
.p-app .ai {
  width: 56px; height: 56px; border-radius: 15px; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; background: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.10); position: relative;
}
.p-app .an { font-size: .72rem; font-weight: 700; color: #1F2937; }
.p-app.wiggle { animation: wiggleAni .3s ease-in-out infinite; }
@keyframes wiggleAni { 0%,100% { transform: rotate(-2.4deg); } 50% { transform: rotate(2.4deg); } }
.p-app .a-del {
  position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%;
  background: #EF4444; color: #fff; border: 2px solid #fff; font-size: .8rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-family: inherit;
}
.p-badge {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; border-radius: 10px;
  background: #EF4444; color: #fff; font-size: .7rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ── 앱 공통 헤더 ── */
.app-bar {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  background: #fff; border-bottom: 1px solid #E5E7EB; flex-shrink: 0;
}
.app-bar .ab-back { border: none; background: transparent; font-size: 1.15rem; cursor: pointer; padding: 4px 8px; color: #374151; font-family: inherit; border-radius: 8px; }
.app-bar .ab-back:active, .app-bar .ab-back:hover { background: #F3F4F6; }
.app-bar .ab-title { font-weight: 900; font-size: 1rem; }
.app-bar .ab-right { margin-left: auto; display: flex; gap: 4px; }
.app-bar .ab-icon { border: none; background: transparent; font-size: 1.05rem; cursor: pointer; padding: 6px 8px; color: #4B5563; font-family: inherit; border-radius: 8px; }

/* ── 설정 리스트 ── */
.set-list { background: #fff; }
.set-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 15px 16px; border: none; border-bottom: 1px solid #F3F4F6; background: #fff;
  font-family: inherit; font-size: .95rem; font-weight: 700; color: #1F2937; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.set-row:active, .set-row:hover { background: #F8FAFC; }
.set-row .sr-ic { font-size: 1.2rem; width: 32px; text-align: center; }
.set-row .sr-sub { display: block; font-size: .76rem; font-weight: 500; color: #9CA3AF; margin-top: 2px; }
.set-row .sr-right { margin-left: auto; color: #9CA3AF; font-size: .85rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* 토글 스위치 */
.tgl { width: 48px; height: 28px; border-radius: 14px; background: #D1D5DB; border: none; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.tgl::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.tgl.on { background: #22C55E; }
.tgl.on::after { left: 23px; }

/* 슬라이더 */
.p-slider-row { padding: 18px 16px; background: #fff; border-bottom: 1px solid #F3F4F6; }
.p-slider-row .sl-label { display: flex; justify-content: space-between; font-size: .9rem; font-weight: 800; margin-bottom: 10px; }
.p-slider { width: 100%; accent-color: #2563EB; height: 30px; }

/* ── 채팅 / 문자 ── */
.msg-list { background: #fff; flex: 1; }
.chat-area { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; background: #EFF3F8; }
.p-bub { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: .92rem; line-height: 1.55; word-break: break-word; animation: pIn .25s ease; }
@keyframes pIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.p-bub.me { align-self: flex-end; background: #2563EB; color: #fff; border-bottom-right-radius: 4px; }
.p-bub.you { align-self: flex-start; background: #fff; color: #1F2937; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.p-bub img, .p-bub .bub-photo { border-radius: 10px; display: block; }
.chat-input-bar { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid #E5E7EB; align-items: center; flex-shrink: 0; }
.chat-input-bar .ci-plus { border: none; background: #F3F4F6; width: 38px; height: 38px; border-radius: 50%; font-size: 1.15rem; cursor: pointer; flex-shrink: 0; font-family: inherit; color: #374151; }
.chat-input-bar input { flex: 1; font-family: inherit; font-size: .95rem; padding: 10px 14px; border: 1.5px solid #E5E7EB; border-radius: 20px; min-width: 0; }
.chat-input-bar input:focus { outline: none; border-color: #2563EB; }
.chat-input-bar .ci-send { border: none; background: #2563EB; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 1rem; cursor: pointer; flex-shrink: 0; }

/* ── 카메라 ── */
.cam-view { flex: 1; background: linear-gradient(160deg, #1E3A5F, #0F172A); display: flex; align-items: center; justify-content: center; position: relative; min-height: 300px; }
.cam-scene { font-size: 4.5rem; }
.cam-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.cam-flash.go { animation: flashAni .28s ease; }
@keyframes flashAni { 0% { opacity: 0; } 30% { opacity: .95; } 100% { opacity: 0; } }
.cam-bar { display: flex; align-items: center; justify-content: center; padding: 16px; background: #0B1220; gap: 40px; flex-shrink: 0; }
.cam-shutter { width: 62px; height: 62px; border-radius: 50%; background: #fff; border: 5px solid #94A3B8; cursor: pointer; }
.cam-shutter:active { transform: scale(.93); }
.cam-thumb { width: 44px; height: 44px; border-radius: 10px; background: #1F2937; border: 2px solid #475569; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; overflow: hidden; }

/* 앨범 */
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 6px; background: #fff; flex: 1; align-content: start; }
.album-ph {
  aspect-ratio: 1; border: 3px solid transparent; border-radius: 8px; background: #E2E8F0;
  display: flex; align-items: center; justify-content: center; font-size: 2rem; cursor: pointer; position: relative;
  font-family: inherit;
}
.album-ph.sel { border-color: #2563EB; }
.album-ph .ph-new { position: absolute; top: 4px; right: 4px; background: #EF4444; color: #fff; font-size: .58rem; font-weight: 900; border-radius: 4px; padding: 1px 4px; }

/* ── 스토어 ── */
.store-search { display: flex; gap: 8px; padding: 12px 14px; background: #fff; border-bottom: 1px solid #F3F4F6; }
.store-search input { flex: 1; font-family: inherit; font-size: .95rem; padding: 10px 14px; border: 1.5px solid #E5E7EB; border-radius: 22px; min-width: 0; }
.store-search input:focus { outline: none; border-color: #2563EB; }
.store-search button { border: none; background: #2563EB; color: #fff; border-radius: 22px; padding: 0 16px; font-family: inherit; font-weight: 800; cursor: pointer; }
.store-item { display: flex; align-items: center; gap: 12px; padding: 14px; background: #fff; border-bottom: 1px solid #F3F4F6; }
.store-item .si-ic { width: 52px; height: 52px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; background: #EFF6FF; flex-shrink: 0; }
.store-item .si-body { flex: 1; min-width: 0; }
.store-item .si-name { font-weight: 900; font-size: .95rem; }
.store-item .si-sub { font-size: .76rem; color: #9CA3AF; }
.store-item .si-btn { border: none; background: #EFF6FF; color: #2563EB; font-family: inherit; font-weight: 900; font-size: .85rem; padding: 8px 18px; border-radius: 18px; cursor: pointer; flex-shrink: 0; }
.si-prog { height: 6px; border-radius: 3px; background: #E5E7EB; margin-top: 8px; overflow: hidden; }
.si-prog i { display: block; height: 100%; background: #2563EB; width: 0; transition: width 1.4s ease; }

/* ── 팝업/시트 ── */
.p-sheet {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 40;
  background: #fff; border-radius: 18px; padding: 14px; box-shadow: 0 -8px 30px rgba(0,0,0,.2);
  animation: sheetIn .25s ease;
}
@keyframes sheetIn { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.p-sheet button { display: block; width: 100%; border: none; background: #F8FAFC; font-family: inherit; font-size: .95rem; font-weight: 700; color: #1F2937; padding: 13px; border-radius: 12px; margin-top: 8px; cursor: pointer; }
.p-sheet button:first-child { margin-top: 0; }
.p-sheet button.danger { color: #DC2626; }
.p-modal { position: absolute; inset: 0; z-index: 45; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.p-modal .pm-box { background: #fff; border-radius: 18px; padding: 22px 20px; text-align: center; width: 100%; max-width: 280px; animation: pIn .2s ease; }
.p-modal .pm-box h4 { font-size: 1rem; margin-bottom: 6px; }
.p-modal .pm-box p { font-size: .84rem; color: #6B7280; line-height: 1.6; word-break: keep-all; margin-bottom: 14px; }
.pm-btns { display: flex; gap: 8px; }
.pm-btns button { flex: 1; border: none; font-family: inherit; font-weight: 800; font-size: .9rem; padding: 11px; border-radius: 10px; cursor: pointer; }
.pm-btns .pm-cancel { background: #F3F4F6; color: #374151; }
.pm-btns .pm-ok { background: #2563EB; color: #fff; }
.pm-btns .pm-danger { background: #EF4444; color: #fff; }

/* 모바일에서 폰 프레임을 화면에 맞게 */
@media (max-width: 480px) {
  .phone { border-radius: 28px; padding: 7px; }
  .p-screen { border-radius: 22px; min-height: 540px; }
}
