:root { --pw-red: #E60012; --pw-dark: #333333; --font-main: 'Noto Sans JP', sans-serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; padding: 0; font-family: var(--font-main); background: #e9ecef; height: 100vh; display: flex; justify-content: center; align-items: center; overflow: hidden; }

.main-wrapper { display: flex; width: 100%; max-width: 900px; height: 100%; max-height: 850px; background: transparent; gap: 20px; align-items: center; justify-content: center; }

/* 스마트폰 메신저 UI */
.app-container { width: 100%; max-width: 400px; height: 100%; background: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,0.15); border-radius: 0; z-index: 10; }
@media (min-width: 768px) { .app-container { height: 90vh; border-radius: 30px; border: 8px solid #333; } }

/* 오피스 맵 UI */
.map-container { display: none; width: 420px; height: 90vh; background: #fff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.08); padding: 25px; flex-direction: column; position: relative; overflow: hidden; }

.map-header { font-size: 18px; font-weight: 700; color: var(--pw-dark); margin-bottom: 15px; display: flex; align-items: center; gap: 10px; border-bottom: 2px solid #f0f0f0; padding-bottom: 15px; }
.map-header::before { content:'📍'; font-size:22px; }

/* 카메라 이미지 */
.location-cam { width: 100%; height: 180px; background: #111; border-radius: 12px; margin-bottom: 20px; overflow: hidden; position: relative; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.location-cam img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease-in-out; }
.location-cam.loaded img { opacity: 1; }
.cam-label { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.6); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 4px; display: flex; align-items: center; gap: 5px; }
.cam-label::before { content:''; width: 6px; height: 6px; background: red; border-radius: 50%; animation: blink 1s infinite; }
@keyframes blink { 0%, 100% {opacity:1;} 50% {opacity:0;} }

/* 오피스 평면도 구역 */
.office-grid { flex: 1; background: #f8f9fa; border: 2px solid #e0e0e0; border-radius: 12px; position: relative; overflow: hidden; }
.room { position: absolute; border: 1px solid #d0d0d0; background: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: bold; color: #aaa; text-align: center; transition: 0.3s; }
.room.active { background: #ffebee; border-color: var(--pw-red); color: var(--pw-red); box-shadow: inset 0 0 10px rgba(230,0,18,0.1); }


#room-0 { top: 60%; left: 10%; width: 35%; height: 30%; } 
#room-1 { top: 60%; left: 55%; width: 35%; height: 30%; } 
#room-2 { top: 35%; left: 55%; width: 35%; height: 15%; } 
#room-3 { top: 10%; left: 10%; width: 35%; height: 40%; } 
#room-4 { top: 10%; left: 55%; width: 35%; height: 15%; background: #333; color: #fff; } 
#room-4.active { background: #220000; color: #ff6b6b; }

/*플레이어 아이콘*/
#player-marker { position: absolute; top: 50%; left: 50%; width: 32px; height: 32px; background: var(--pw-red); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; box-shadow: 0 4px 10px rgba(230,0,18,0.4); z-index: 5; transition: top 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); pointer-events: none; }
#player-marker::after { content:''; position: absolute; width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--pw-red); animation: ping 1.5s infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }

/*OS 및 메신저 UI*/
#os-boot-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=2564&auto=format&fit=crop') no-repeat center center; background-size: cover; z-index: 100; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 0.8s ease-in-out; }
.os-overlay { position: absolute; top:0; left:0; width:100%; height:100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(8px); }
.login-profile-area { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: 85%; }
.os-avatar { width: 100px; height: 100px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 40px; color: #555; box-shadow: 0 4px 15px rgba(0,0,0,0.2); margin-bottom: 15px; }
.os-user-name { font-size: 24px; color: #fff; font-weight: 700; margin-bottom: 25px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.os-input-group { width: 100%; position: relative; }
.os-input { width: 100%; height: 45px; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.3); border-radius: 8px; color: #fff; padding: 0 15px; font-size: 15px; outline: none; margin-bottom: 10px; transition: 0.3s; }
.os-input::placeholder { color: rgba(255,255,255,0.6); }
.os-input:focus { border-color: #fff; background: rgba(255,255,255,0.25); }
.os-btn { width: 100%; height: 45px; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: #fff; font-size: 15px; font-weight: bold; border-radius: 8px; cursor: pointer; transition: 0.2s; margin-bottom: 10px; }
.os-btn:hover { background: rgba(255,255,255,0.3); }
.code-wrap { display: flex; gap: 8px; margin-bottom: 10px; }
.code-input { flex: 2; margin-bottom: 0; }
.code-btn { flex: 1; height: 45px; font-size: 12px; }
.social-login-area { margin-top: 25px; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 40px; border-radius: 6px; font-size: 14px; font-weight: bold; cursor: pointer; border: none; }
.social-btn.google { background: #fff; color: #333; }
.social-btn.ms { background: #00A4EF; color: #fff; }
.os-footer { position: absolute; bottom: 30px; font-size: 12px; color: rgba(255,255,255,0.5); z-index: 2; }
.os-link { color: rgba(255,255,255,0.7); text-decoration: underline; cursor: pointer; font-size: 13px; margin-top: 10px; }

#game-screen { display: none; flex-direction: column; height: 100%; background: #fff; }
.header { height: 70px; padding: 0 20px; background: rgba(255,255,255,0.95); border-bottom: 1px solid #f0f0f0; display: flex; align-items: center; justify-content: space-between; position: absolute; top: 0; left: 0; right: 0; z-index: 10; }
.header-profile { display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; background: #eee; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; color: #555; }
.boss-name { font-size: 15px; font-weight: 700; color: #111; }
.current-location { font-size: 11px; color: #666; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.current-location::before { content:'📍'; font-size:10px; }
.hint-icon-btn { background: #f0f2f5; border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; }

.chat-area { flex: 1; padding: 80px 20px 20px 20px; background: #F4F5F7; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.msg-row { display: flex; flex-direction: column; width: 100%; opacity: 0; animation: popUp 0.3s forwards; }
.msg-row.me { align-items: flex-end; }
.msg-row.boss { align-items: flex-start; }
.bubble { max-width: 75%; padding: 12px 16px; font-size: 15px; line-height: 1.5; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.bubble.boss { background: #FFFFFF; color: #333; border-radius: 18px 18px 18px 4px; }
.bubble.me { background: var(--pw-dark); color: #fff; border-radius: 18px 18px 4px 18px; }
.boss-label { font-size: 11px; color: #999; margin-bottom: 4px; margin-left: 2px; }
@keyframes popUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.typing-wrapper { display: none; margin-bottom: 10px; padding-left: 20px; }
.typing-bubble { background: #fff; padding: 12px 16px; border-radius: 18px; display: inline-flex; gap: 4px; align-items: center; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.dot { width: 6px; height: 6px; background: #ccc; border-radius: 50%; animation: bounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

.input-dock { background: #fff; padding: 15px 20px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(0,0,0,0.05); display: flex; align-items: center; gap: 10px; width: 100%; }
.chat-input { flex: 1; height: 44px; background: #F2F4F7; border: 1px solid transparent; border-radius: 22px; padding: 0 20px; font-size: 15px; outline: none; transition: 0.2s; }
.chat-input:focus { background: #fff; border-color: #ddd; }
.send-btn { width: 44px; height: 44px; background: var(--pw-red); border-radius: 50%; border: none; color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.2s; flex-shrink: 0; }
.send-btn:hover { transform: scale(1.05); }
.send-btn svg { width: 20px; height: 20px; fill: currentColor; margin-left: 2px; }

.modal-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 200; display: none; justify-content: center; align-items: center; animation: fadeIn 0.3s; }
.modal-box { background: white; width: 85%; max-width: 320px; padding: 25px; border-radius: 20px; text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,0.3); position: relative; animation: slideUp 0.3s; }
.modal-close-x { position: absolute; top: 15px; right: 15px; background: none; border: none; font-size: 20px; color: #999; cursor: pointer; }
.modal-title { font-size: 18px; font-weight: bold; color: var(--pw-red); margin-bottom: 15px; }
.modal-content { font-size: 14px; color: #333; line-height: 1.6; margin-bottom: 25px; text-align: left; }

#game-over { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); backdrop-filter: blur(5px); z-index: 300; display: none; flex-direction: column; justify-content: center; align-items: center; color: #fff; text-align: center; padding: 40px; }
.restart-btn { padding: 14px 32px; border: 2px solid rgba(255,255,255,0.3); border-radius: 30px; background: transparent; color: #fff; font-weight: bold; cursor: pointer; margin-top: 10px; }
.restart-btn:hover { background: #fff; color: #000; }

.my-info-btn { background: #f0f2f5; border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-right: 8px; transition: 0.2s; }
.my-info-btn:hover { background: #e0e0e0; }
.profile-card { background: linear-gradient(135deg, #fff, #f8f9fa); padding: 0; overflow: hidden; }
.card-header { background: var(--pw-red); color: white; padding: 15px; font-weight: bold; font-size: 16px; letter-spacing: 1px; }
.card-body { padding: 25px 20px; text-align: left; }
.stat-row { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; padding: 12px 0; }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 13px; color: #666; font-weight: bold; }
.stat-value { font-size: 16px; font-weight: bold; color: var(--pw-dark); }
.rank-value { font-size: 18px; color: var(--pw-red); font-weight: 800; }


/*토스트 팝업 디자인 */
#toast-container { position: absolute; top: 15px; left: 0; right: 0; z-index: 999; display: flex; flex-direction: column; align-items: center; pointer-events: none; padding: 0 15px; }
.toast { background: rgba(30, 30, 35, 0.9); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); box-shadow: 0 8px 24px rgba(0,0,0,0.25); border-radius: 16px; border: 1px solid rgba(255,255,255,0.1); padding: 14px 18px; width: 100%; max-width: 340px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; transform: translateY(-40px); opacity: 0; transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1); pointer-events: auto; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast-icon { font-size: 22px; flex-shrink: 0; background: rgba(255,255,255,0.1); width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.toast.success .toast-icon { color: #32D74B; background: rgba(50, 215, 75, 0.15); }
.toast.error .toast-icon { color: #FF453A; background: rgba(255, 69, 58, 0.15); }
.toast.info .toast-icon { color: #0A84FF; background: rgba(10, 132, 255, 0.15); }
.toast-body { flex: 1; color: #fff; }
.toast-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; letter-spacing: 0.3px; }
.toast-msg { font-size: 12px; color: rgba(255,255,255,0.7); line-height: 1.4; }
.toast-close { background: none; border: none; font-size: 16px; color: rgba(255,255,255,0.4); cursor: pointer; padding: 5px; margin-left: auto; transition: 0.2s; }
.toast-close:hover { color: #fff; }