* { box-sizing: border-box; font-family: 'Gaegu', cursive, sans-serif; }

/* 1. 바탕 화면 (스크롤 허용 및 중앙 정렬) */
body {
  background-color: #f7f4eb;
  margin: 0;
  padding: 20px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

/* 2. 다이어리 카드 틀 (PC/모바일 공통 반응형 고정) */
.diary-container {
  background: #ffffff;
  width: 90%;
  max-width: 400px; /* PC에서도 아담한 카드 크기 유지 */
  margin: 0 auto;
  padding: 0;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 2px solid #ebdccb;
  position: relative;
  text-align: center;
  overflow: hidden;
}

/* 3. 표지 화면 (완벽한 원본 비율 유지) */
.lock-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.3; /* 표지 비율 유지 */
  background-image: url('bear.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f7f4eb;
}
/* 통통 튀는 곰발자국 위치 (퍼센트 단위로 지정되어 PC/모바일 상관없이 정확한 위치 유지) */
.paw-click-area {
  position: absolute;
  right: 0%;
  top: 42%;
  width: 24%;
  height: auto;
  cursor: pointer;
  z-index: 10;
  transform-origin: center center;
  animation: bouncePaw 1.8s infinite ease-in-out;
}

.paw-click-area:hover {
  filter: brightness(1.05);
}

/* 아래로 튀는 범위도 미세 조절 */
@keyframes bouncePaw {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-5px) scale(1.03);
  }
}

/* 1. 일기장 메인 공간 (속지 배경 비율에 맞춰 패딩 조정) */
.diary-main-content {
  display: none;
  padding: 20px 15px;
  animation: fadeIn 0.6s ease forwards;
  
  /* 🖼️ 100% 100% 대신 contain으로 수정하여 비율 찌그러짐 방지 */
  background-size: contain;
  background-position: center bottom;
  background-repeat: no-repeat;
  border-radius: 18px;
}

.date-cell {
  background-color: transparent !important; /* 👈 배경색 강제 투명 처리 */
  border: 1px solid rgba(235, 220, 203, 0.3); /* 아주 연한 테두리만 살짝 */
  border-radius: 8px;
  min-height: 90px;
  padding: 4px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.date-cell:hover {
  background-color: rgba(255, 255, 255, 0.4) !important; /* 마우스 올릴 때만 반투명 */
  border-color: rgba(235, 220, 203, 0.8);
}

.date-cell.empty {
  background-color: transparent !important;
  border: none;
  cursor: default;
}

/* 날짜 숫자 스타일 (어두운 속지에서도 잘 보이도록 보정) */
.date-num {
  font-size: 1.1rem;
  color: #4a3b30;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8); /* 흰 테두리 효과로 가독성 확보 */
}

/* 년/월 제목: 한 줄 텍스트 위에 투명 셀렉트를 겹쳐 탭하면 선택창이 열림 */
.calendar-title-group {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-title-text {
  font-size: 1.55rem;
  font-weight: bold;
  color: #5a4636;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.calendar-title-caret {
  font-size: 0.7rem;
  color: #b5a08c;
  margin-left: 2px;
}

.year-month-select {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  border: none;
  background: transparent;
}

#selectYear { left: 0; }
#selectMonth { right: 0; }

/* 3. 상단 및 하단 버튼 배경 투명감 주기 */
.calendar-header h2 {
  color: #5a4636;
  font-size: 1.8rem;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8); /* 배경이 어두워도 글자 식별 가능하도록 효과 */
}

.day-header {
  font-weight: bold;
  color: #5a4636;
  padding: 6px 0;
  font-size: 1.1rem;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.calendar-header h2 { margin: 0; color: #5a4636; font-size: 1.8rem; }

.nav-btn {
  background: none;
  border: none;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: #b5a08c;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .nav-btn:hover { color: #b5835a; }
}

.nav-btn:active { color: #b5835a; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-header { font-weight: bold; color: #8c735d; padding: 8px 0; font-size: 1.2rem; }
.day-header.sun { color: #d9534f; }
.day-header.sat { color: #0275d8; }

.badge-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 3px;
}

.entry-badge {
  font-size: 0.72rem;
  line-height: 1.15;
  text-align: center;
  border-radius: 4px;
  padding: 1px 2px;
  white-space: normal;
  word-break: keep-all;
}
.entry-badge.paw { background-color: #fcebe1; color: #8c533e; }
.entry-badge.secret { background-color: #e2e3e5; color: #383d41; }

.action-buttons {
  margin-top: 25px;
  display: flex;
  justify-content: center;
  gap: 15px;
}

.btn-main {
  background-color: #6b8e23;
  color: white;
  border: none;
  padding: 8px 20px;
  font-size: 1.2rem;
  border-radius: 15px;
  cursor: pointer;
}

.btn-icon {
  background-color: #b5835a;
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  font-size: 1.3rem;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.admin-hotspot {
  position: absolute;
  right: 4px;
  bottom: 55px;
  width: 100px;
  height: 110px;
  z-index: 5;
  background: transparent;
}

.btn-back {
  background: none;
  border: none;
  color: #8c6239;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 15px;
  padding: 0;
}

.admin-section { display: none; text-align: left; }
.admin-card {
  background-color: #fffdf9;
  border: 1px solid #ebdccb;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-card-info { font-size: 1.2rem; color: #4a3b30; }

.status-badge {
  font-size: 0.9rem;
  padding: 2px 10px;
  border-radius: 10px;
  margin-left: 6px;
}
.status-badge.public { background-color: #e2f0d9; color: #385723; }
.status-badge.secret { background-color: #e2e3e5; color: #383d41; }

.btn-toggle-secret {
  background-color: #f2ebd9;
  color: #8c735d;
  border: 1px solid #d3c4b1;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}

.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-card {
  background-color: #fffdf9;
  border: 2px solid #ebdccb;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  padding: 25px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  text-align: left;
  display: flex;
  flex-direction: column;
}

.modal-scroll-area {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

#viewModalOverlay .modal-card {
  height: 85vh;
}

.modal-date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f0e6d8;
  padding-bottom: 12px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.modal-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-date {
  font-size: 1.3rem;
  color: #8c735d;
  font-weight: bold;
}

.modal-nav-arrow {
  background: none;
  border: none;
  color: #c9bba8;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}

.modal-nav-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

@media (max-width: 768px) {
  .modal-nav-arrow {
    display: none;
  }
}

.btn-icon-small {
  background-color: #f2ebd9;
  color: #6b8e23;
  border: none;
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.author-tabs {
  margin-bottom: 15px;
}

.modal-text {
  font-size: 1.25rem;
  color: #5a4636;
  line-height: 1.75;
  white-space: pre-line;
  min-height: 100px;
  margin-bottom: 6px;
}

.write-modal-title { margin-bottom: 22px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 1rem; color: #a89684; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 8px 12px; font-size: 1.1rem;
  border: 1px solid #d3c4b1; border-radius: 8px; background-color: #fff;
}
textarea.form-control { height: 120px; resize: vertical; }

input.form-control[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
}
input.form-control[type="date"]:disabled { background-color: #f2ebd9; color: #a89684; }

.modal-btn-group { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-shrink: 0; }
.btn-edit { background-color: #4a7c59; color: white; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;}
.btn-delete { background-color: #d9534f; color: white; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;}
.btn-restore { background-color: #0275d8; color: white; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;}
.btn-cancel { background-color: #ccc; color: #333; border: none; padding: 6px 14px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;}
.btn-submit { background-color: #b5835a; color: white; border: none; padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 1.1rem;}
.btn-delete-text { background: none; border: none; color: #b5453f; padding: 6px 10px; cursor: pointer; font-size: 1.05rem; }
.btn-close-pill { background-color: #b5835a; color: white; border: none; padding: 6px 22px; border-radius: 20px; cursor: pointer; font-size: 1.1rem; }

.toast {
  position: fixed;
  top: 12%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background-color: #fffdf9;
  color: #5a4636;
  border: 1px solid #ebdccb;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 1.15rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 200;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.password-card {
  background-color: #fffdf9;
  border: 1px solid #ebdccb;
  border-radius: 16px;
  width: 85%;
  max-width: 320px;
  padding: 28px 24px;
  text-align: center;
}

.password-emoji {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.password-label {
  font-size: 1.05rem;
  color: #8c735d;
  font-weight: bold;
  margin-bottom: 16px;
}

.password-digit-boxes {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.password-digit-box {
  width: 34px;
  height: 42px;
  border: none;
  border-bottom: 2px solid #d3c4b1;
  border-radius: 0;
  text-align: center;
  font-size: 1.3rem;
  color: #5a4636;
  background: transparent;
  font-family: 'Gaegu', cursive, sans-serif;
  padding: 0;
}

.password-digit-box:focus {
  outline: none;
  border-bottom-color: #b5835a;
}

.password-error {
  font-size: 0.85rem;
  color: #b5453f;
  margin-bottom: 12px;
}

.password-confirm-btn {
  width: 100%;
  padding: 9px 0;
}

.password-cancel {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #a89684;
  cursor: pointer;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}