/* ===== 공통 스타일 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fdf8f8;
  color: #333;
  min-height: 100vh;
}

.page { max-width: 480px; margin: 0 auto; padding: 1.5rem 1rem; }

/* 버튼 */
.btn {
  display: inline-block; width: 100%; padding: 11px 20px;
  font-size: 14px; border-radius: 10px; cursor: pointer;
  border: 0.5px solid #ddd; background: #fff; color: #333;
  text-align: center;
}
.btn:hover { background: #f5f5f5; }
.btn.primary { background: #9b8ec4; color: #fff; border-color: #9b8ec4; }
.btn.primary:hover { background: #7f72b0; }
.btn.danger { background: #f7d6e0; color: #993556; border-color: #ED93B1; }

/* 인풋 */
input, textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 0.5px solid #ddd; border-radius: 8px;
  background: #fff; outline: none;
  font-family: inherit;
}
input:focus, textarea:focus { border-color: #9b8ec4; }
textarea { resize: none; height: 88px; }

/* 카드 */
.card {
  background: #fff; border: 0.5px solid #eee;
  border-radius: 14px; padding: 1.25rem;
  margin-bottom: 1rem;
}

/* 필드 */
.field { margin-bottom: 1rem; }
.field label { font-size: 13px; color: #888; display: block; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: #bbb; margin-top: 4px; line-height: 1.5; }
.field .error { font-size: 11px; color: #e05; margin-top: 4px; display: none; }

/* PIN 인풋 */
.pin-input {
  text-align: center; font-size: 22px;
  font-weight: 500; letter-spacing: 8px;
  max-width: 160px;
}

/* 헤더 */
.header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 1.25rem;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-logo {
  width: 100px; height: 100px; border-radius: 50%;
  object-fit: cover;
}
.header-title { font-size: 14px; font-weight: 500; }
.header-sub { font-size: 11px; color: #aaa; }
.make-link {
  font-size: 12px; color: #bbb; text-decoration: underline;
  text-underline-offset: 2px; cursor: pointer;
}
.make-link:hover { color: #888; }

/* 뒤로가기 */
.back {
  font-size: 13px; color: #aaa; cursor: pointer;
  display: inline-block; margin-bottom: 1.25rem;
  background: none; border: none;
}
.back:hover { color: #555; }

/* 편지 그리드 */
.note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px; margin-bottom: 1.25rem;
}
.note-tile {
  aspect-ratio: 1; border-radius: 10px;
  cursor: pointer; position: relative; overflow: hidden;
  transition: transform .13s;
}
.note-tile:hover { transform: scale(1.04); }
.note-tile .lace {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; z-index: 1;
}
.note-tile .tile-name {
  position: absolute; bottom: 22px; left: 0; right: 0;
  text-align: center; font-size: 11px; font-weight: 500;
  color: rgba(60,30,50,0.8); z-index: 2;
}
.note-tile .tile-content {
  position: absolute; inset: 0; bottom: 20px;
  display: flex; align-items: center; justify-content: center;
  padding: 8px; font-size: 11px; line-height: 1.5;
  color: rgba(60,30,50,0.85); z-index: 2;
  text-align: center; word-break: break-all;
}
.note-tile .tile-date {
  position: absolute; bottom: 7px; left: 0; right: 0;
  text-align: center; font-size: 9px;
  color: rgba(80,50,60,0.6); z-index: 2;
}
.note-tile .x-btn {
  position: absolute; top: 5px; right: 5px; z-index: 4;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,0.88);
  border: 0.5px solid rgba(180,120,140,0.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 10px; color: #993556;
}
.note-tile .x-btn:hover { background: #f7d6e0; }

/* 빈 상태 */
.empty-state {
  grid-column: 1/-1; text-align: center;
  padding: 2.5rem 0; font-size: 13px; color: #bbb; line-height: 1.8;
}

/* 페이지네이션 */
.pagination {
  display: flex; justify-content: center; gap: 6px;
  margin-bottom: 1.25rem;
}
.page-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid #e8d5dd; background: #fff;
  font-size: 13px; color: #a07080; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.page-btn:hover { background: #f7e8ef; }
.page-btn.active { background: #e8a0b8; color: #fff; border-color: #e8a0b8; font-weight: 700; }



/* 삭제/모달 배경 */
.modal-bg {
  min-height: 240px; background: rgba(0,0,0,0.36);
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; margin-bottom: 1rem;
}
.modal {
  background: #fff; border-radius: 14px;
  padding: 1.5rem; width: 270px;
}
.modal h3 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.modal p { font-size: 13px; color: #888; margin-bottom: 12px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }

/* 완료 화면 */
.done-wrap { text-align: center; padding: 3rem 1rem; }
.done-wrap .icon { font-size: 44px; margin-bottom: 12px; }
.done-wrap h2 { margin-bottom: 6px; }
.done-wrap p { font-size: 13px; color: #888; margin-bottom: 1.5rem; line-height: 1.6; }

/* URL 박스 */
.url-box {
  display: flex; align-items: center; gap: 8px;
  background: #f5f5f5; border: 0.5px solid #eee;
  border-radius: 10px; padding: 10px 12px; margin-bottom: 1rem;
}
.url-text { flex: 1; font-size: 13px; }
.url-copy { padding: 4px 10px; font-size: 12px; width: auto; }

/* 구분선 */
.divider { border: none; border-top: 0.5px solid #eee; margin: 1rem 0; }

/* 글자수 */
.char-count { font-size: 11px; color: #bbb; text-align: right; margin-top: 4px; }

/* 위험 구역 */
.danger-zone {
  border: 0.5px solid #ED93B1; border-radius: 10px;
  padding: 1rem 1.25rem; margin-top: 1rem;
}
.danger-label { font-size: 11px; color: #993556; font-weight: 500; margin-bottom: 8px; }
