/* ===== 방 전체 ===== */
.room {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #F5F0EB;
}

/* ===== 방 배경 / 웨이빙 비디오 공통 ===== */
.room-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  z-index: 0;
  background: #E8B090;  /* 스크린샷의 피치 배경색 */
}

/* ===== 친구 이름 (우상단) ===== */
.friend-name {
  position: absolute;
  top: 4%;
  right: 5%;
  font-size: 15px;
  font-weight: 700;
  color: #7A6247;
  letter-spacing: -0.3px;
  z-index: 20;
}

/* ===== 캐릭터 영역 ===== */
/*
  등각투영 방 기준으로
  캐릭터는 바닥 중앙 앞쪽에 위치.
  이미지가 contain이므로 % 기반으로 잡음.
*/
.character-zone {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

.room-character {
  position: absolute;
  bottom: 32%;
  left: 50%;
  transform: translateX(-50%);
  width: 38vw;
  max-width: 180px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(140,90,50,0.25));
  z-index: 10;
  cursor: pointer;
}

/* 아이 외 캐릭터 — 키가 크므로 축소 */
.room-character.char-adult {
  width: 18vw;
  max-width: 88px;
  bottom: 26%;
}

@keyframes idleFloat {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-7px); }
}

/* 탭 피드백 */
.character-zone:active .room-character {
  animation: none;
  transform: scale(0.94) translateY(3px);
  filter:
    drop-shadow(0 6px 6px rgba(180,140,100,0.2))
    brightness(0.95);
}

/* 튀어오르고 이동 */
.character-zone.bounce .room-character {
  animation: charBounce 0.36s ease forwards;
}

@keyframes charBounce {
  0%   { transform: translateY(0) scale(1); }
  35%  { transform: translateY(-20px) scale(1.06); }
  70%  { transform: translateY(4px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

/* ===== 탭 힌트 (하단 중앙 고정) ===== */
.tap-hint {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(90,65,45,0.5);
  color: white;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  animation: hintPulse 2.8s ease-in-out infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.65; }
  50%       { opacity: 1; }
}

/* ===== 장소 선택 탭 ===== */
.location-tabs {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 30px;
  padding: 5px 8px;
}

.loc-tab {
  background: none;
  border: none;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #7A6247;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.loc-tab.active {
  background: rgba(196,132,90,0.85);
  color: white;
}

/* ===== 요리 버튼 ===== */
.cook-btn {
  position: absolute;
  bottom: 50%;
  right: 8%;
  z-index: 20;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #5A3D28;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ===== 나가기 버튼 (현관) ===== */
.go-out-btn {
  position: absolute;
  bottom: 38%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(80, 60, 40, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  white-space: nowrap;
}

/* ===== 목적지 선택 모달 ===== */
.go-out-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

.go-out-box {
  background: #fff8f3;
  border-radius: 24px 24px 16px 16px;
  padding: 24px 20px 20px;
  width: 90%;
  max-width: 360px;
}

.go-out-title {
  font-size: 17px;
  font-weight: 700;
  color: #3a2510;
  text-align: center;
  margin-bottom: 20px;
}

.go-out-options {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.go-out-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #e8d5c0;
  border-radius: 16px;
  padding: 20px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.go-out-option:active {
  border-color: #C4844A;
  background: #fff5ec;
}

.go-out-emoji {
  font-size: 32px;
}

.go-out-name {
  font-size: 15px;
  font-weight: 700;
  color: #3a2510;
}

.go-out-cancel {
  width: 100%;
  background: none;
  border: none;
  padding: 12px;
  font-size: 14px;
  color: #a08060;
  cursor: pointer;
  text-align: center;
}

/* ===== 집에 가기 버튼 (야외) ===== */
.go-home-btn {
  position: absolute;
  bottom: 30%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 24px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 700;
  color: #5A3D28;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  white-space: nowrap;
}

/* ===== 잠자기 버튼 ===== */
.sleep-btn {
  position: absolute;
  bottom: 44%;
  right: 14%;
  z-index: 20;
  background: rgba(100, 90, 150, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  white-space: nowrap;
}

/* ===== 잠자기 팝업 ===== */
.sleep-popup {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(20, 15, 40, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sleep-box {
  background: linear-gradient(160deg, #1e1640 0%, #2a2060 100%);
  border-radius: 24px;
  padding: 28px 24px 24px;
  width: 82%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.sleep-char-img {
  width: 75%;
  max-width: 220px;
  border-radius: 16px;
  object-fit: contain;
}

.sleep-msg {
  font-size: 15px;
  color: #e8dff8;
  text-align: center;
  line-height: 1.7;
  white-space: pre-line;
  font-weight: 500;
}

.sleep-close-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  padding: 10px 28px;
  color: #e8dff8;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.sleep-close-btn:active {
  background: rgba(255,255,255,0.22);
}

/* ===== 요리 선택 모달 ===== */
.cook-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(env(safe-area-inset-bottom) + 20px);
}

.cook-box {
  background: #fff8f3;
  border-radius: 24px 24px 16px 16px;
  padding: 24px 20px 20px;
  width: 90%;
  max-width: 360px;
}

.cook-title {
  font-size: 16px;
  font-weight: 700;
  color: #5A3D28;
  text-align: center;
  margin-bottom: 16px;
}

.cook-dishes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.cook-dish {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: none;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 1px 6px rgba(140,90,50,0.08);
  transition: background 0.15s;
}

.cook-dish:active { background: #FDF0E8; }

.dish-emoji { font-size: 28px; flex-shrink: 0; }
.dish-name  { font-size: 15px; font-weight: 700; color: #5A3D28; display: block; }
.dish-desc  { font-size: 12px; color: #A8896A; display: block; margin-top: 2px; }

.cook-cancel {
  width: 100%;
  background: none;
  border: none;
  font-size: 13px;
  color: #A8896A;
  cursor: pointer;
  padding: 8px;
  text-align: center;
}

/* ===== 요리 완성 팝업 ===== */
.cook-done {
  position: absolute;
  inset: 0;
  z-index: 110;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cook-done-box {
  background: #fff8f3;
  border-radius: 24px;
  padding: 36px 28px;
  width: 78%;
  max-width: 280px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.cook-done-img {
  width: 100%;
  max-width: 220px;
  height: 160px;
  object-fit: cover;
  border-radius: 16px;
  animation: popIn 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
  box-shadow: 0 4px 16px rgba(140,90,50,0.18);
}

@keyframes popIn {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.cook-done-msg {
  font-size: 15px;
  color: #5A3D28;
  line-height: 1.7;
  white-space: pre-line;
  font-weight: 500;
}

.cook-done-btn {
  background: #C4845A;
  color: white;
  border: none;
  border-radius: 14px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}

/* ===== 일기 버튼 (우하단) ===== */
.diary-fab {
  position: absolute;
  bottom: 4%;
  right: 5%;
  z-index: 35;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: none;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
  box-shadow: 0 3px 16px rgba(90,61,40,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: transform 0.15s;
  overflow: hidden;
}

.diary-fab img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.diary-fab:active {
  transform: scale(0.92);
}

/* ===== 특별한 날 배너 ===== */
.special-day-banner {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 28;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255,248,230,0.88);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(220,170,80,0.5);
  border-radius: 20px;
  padding: 12px 20px;
  white-space: nowrap;
  animation: floatIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
}

@keyframes floatIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.special-day-text {
  font-size: 14px;
  font-weight: 700;
  color: #8a5c00;
}

.special-day-btn {
  background: linear-gradient(135deg, #e8a020, #c97020);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.special-day-btn:active {
  opacity: 0.8;
}

/* ===== 생일 배너 ===== */
.birthday-banner {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 29;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255, 240, 250, 0.90);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(220, 140, 180, 0.5);
  border-radius: 20px;
  padding: 12px 20px;
  white-space: nowrap;
  animation: floatIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.birthday-text {
  font-size: 14px;
  font-weight: 700;
  color: #8a3060;
}

.birthday-letter-btn {
  background: linear-gradient(135deg, #e860a0, #c03080);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
}

.birthday-letter-btn:active {
  opacity: 0.8;
}

/* ===== 건강한 날 / 아픈 날 ===== */
.status-btns {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 25;
}

.status-btn {
  padding: 9px 20px;
  border-radius: 50px;
  border: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.2s;
  white-space: nowrap;
}

.status-btn.healthy {
  background: rgba(255,255,255,0.55);
  color: #4a7c59;
  border-color: rgba(100,180,120,0.4);
}

.status-btn.sick {
  background: rgba(255,255,255,0.55);
  color: #7a6080;
  border-color: rgba(160,130,200,0.4);
}

.status-btn.healthy.active {
  background: rgba(100,180,120,0.85);
  color: #fff;
  border-color: #4a7c59;
}

.status-btn.sick.active {
  background: rgba(160,130,200,0.85);
  color: #fff;
  border-color: #7a6080;
}

/* ===== 설정 버튼 ===== */
.settings-btn {
  position: absolute;
  top: 4%;
  right: 5%;
  z-index: 30;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
}

.settings-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-box {
  background: #fff8f3;
  border-radius: 20px;
  padding: 28px 24px;
  width: 75%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.settings-box hr {
  border: none;
  border-top: 1px solid #e8d8c8;
  margin: 4px 0;
}

.settings-title {
  font-size: 16px;
  font-weight: 700;
  color: #5A3D28;
  margin: 0 0 4px;
}

.settings-item {
  width: 100%;
  background: #f0e0d0;
  border: none;
  border-radius: 12px;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  color: #5A3D28;
  cursor: pointer;
  text-align: center;
  box-sizing: border-box;
}

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.settings-close {
  background: none;
  border: none;
  font-size: 13px;
  color: #aaa;
  cursor: pointer;
  padding: 4px;
}

.settings-logout {
  color: #c05050 !important;
}

.settings-context-hint {
  font-size: 12px;
  color: #A8896A;
  margin: -4px 0 8px;
  line-height: 1.5;
}

/* ===== 기억 관리 칩 ===== */
.memory-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 12px;
}

.memory-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0e4d8;
  border-radius: 20px;
  padding: 6px 10px 6px 14px;
  font-size: 13px;
  color: #5A3D28;
  font-weight: 600;
}

.memory-chip button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #A8896A;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.memory-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.memory-input {
  flex: 1;
  background: #f7ece3;
  border: 1px solid #E0D0C0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #5A3D28;
  outline: none;
}

.memory-add-btn {
  background: #C4845A;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  white-space: nowrap;
}

/* ===== 유틸 ===== */
.hidden {
  display: none !important;
}

/* ===== 태블릿 반응형 (768px+) ===== */
@media (min-width: 768px) {
  /* 방 화면은 풀스크린으로 */
  .app:has(.room) {
    max-width: 100%;
    box-shadow: none;
  }

  /* 배경 이미지: 빈 공간 없이 꽉 채우기 */
  .room-bg {
    object-fit: cover;
    object-position: center 25%;
  }

  /* 캐릭터 크기 — 태블릿 화면에 맞게 */
  .room-character {
    width: 28vw;
    max-width: 240px;
    bottom: 30%;
  }

  .room-character.char-adult {
    width: 16vw;
    max-width: 150px;
    bottom: 25%;
  }

  /* 탭 바 */
  .location-tabs {
    gap: 12px;
    padding: 7px 14px;
  }

  .loc-tab {
    padding: 9px 22px;
    font-size: 14px;
  }

  /* 기능 버튼들 */
  .cook-btn  { padding: 13px 26px; font-size: 15px; }
  .sleep-btn { padding: 13px 26px; font-size: 15px; }
  .go-out-btn  { padding: 13px 28px; font-size: 15px; }
  .go-home-btn { padding: 13px 28px; font-size: 15px; }

  /* 건강/아픈 버튼 */
  .status-btns { bottom: 18%; gap: 14px; }
  .status-btn  { padding: 11px 26px; font-size: 15px; }

  /* 탭 힌트 */
  .tap-hint { font-size: 15px; padding: 10px 26px; }

  /* 설정 버튼 */
  .settings-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }

  /* 설정 모달 */
  .settings-box {
    width: 320px;
    max-width: 320px;
    padding: 32px 28px;
  }

  .settings-item { font-size: 15px; padding: 15px; }

  /* 일기 FAB */
  .diary-fab {
    width: 60px;
    height: 60px;
    border-radius: 16px;
  }

  .diary-fab img {
    width: 42px;
    height: 42px;
  }

  /* 특별한 날 / 생일 배너 */
  .special-day-banner,
  .birthday-banner {
    top: 7%;
    padding: 14px 24px;
  }

  .special-day-text,
  .birthday-text { font-size: 15px; }

  .special-day-btn,
  .birthday-letter-btn { font-size: 15px; padding: 10px 24px; }

  /* 요리 / 잠자기 팝업 */
  .cook-box,
  .go-out-box { max-width: 440px; padding: 28px 24px 24px; }

  .cook-done-box { max-width: 340px; padding: 40px 32px; }

  .sleep-box { max-width: 380px; padding: 32px 28px; }

  /* 나가기 모달 옵션 */
  .go-out-option { padding: 24px 20px; }
  .go-out-emoji  { font-size: 38px; }
  .go-out-name   { font-size: 17px; }
}

.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}


/* ===== 빛 오버레이 (시간대별 - 나중에 활성화) ===== */
.light-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  transition: opacity 2s ease;
}

.light-overlay.day {
  background: radial-gradient(ellipse at 35% 25%, rgba(255,220,100,0.12) 0%, transparent 55%);
  opacity: 1;
}

.light-overlay.night {
  background: radial-gradient(ellipse at 65% 15%, rgba(80,110,180,0.18) 0%, transparent 55%);
  opacity: 1;
}
