/* ============================================
   猪猪鸡小窝 - 浅粉色主题样式
   ============================================ */

:root {
  --pink-bg: #FFF0F3;
  --pink-light: #FFD6E0;
  --pink-mid: #FFB3C6;
  --pink-primary: #FF8FA3;
  --pink-dark: #FF6B8A;
  --pink-deep: #E8507A;

  --gold: #FFD700;
  --gold-dark: #E6BE00;

  --text-primary: #5D4E5F;
  --text-secondary: #9B8A90;
  --text-muted: #B5A0A8;

  --card-bg: #FFFFFF;
  --card-shadow: 0 2px 12px rgba(255, 143, 163, 0.12);
  --card-radius: 16px;

  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --tab-bar-height: 64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  background: var(--pink-bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- App Shell --- */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 8px);
  position: relative;
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, var(--pink-bg) 80%, transparent);
}

.logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pink-dark);
  white-space: nowrap;
}

.btn-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.btn-icon:active { transform: scale(0.9); }

/* --- Tab Content --- */
.tab-content { flex: 1; padding: 0 16px; }

.tab-panel { display: none; animation: fadeSlideIn 0.3s ease; }
.tab-panel.active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Cards --- */
.card {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--card-shadow);
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

/* --- Welcome Card --- */
.welcome-card {
  text-align: center;
  padding: 28px 18px;
  background: linear-gradient(135deg, #FFF5F7, #FFE8EC);
}

.welcome-illustration {
  font-size: 2.5rem;
  margin-bottom: 8px;
  animation: bounce 2s infinite;
}

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

.welcome-card h2 {
  font-size: 1.3rem;
  color: var(--pink-deep);
  margin-bottom: 4px;
}

.welcome-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-line {
  font-size: 0.75rem;
  margin-top: 6px;
  font-weight: 600;
}

/* --- Mood Card --- */
.mood-card { text-align: center; }

.mood-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 12px;
}

.mood-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 12px;
  transition: background 0.15s;
}
.mood-item:hover { background: #FFF5F7; }

.mood-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.mood-emoji {
  font-size: 2rem;
  transition: transform 0.2s;
}

.mood-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.mood-divider {
  font-size: 1.3rem;
  opacity: 0.5;
}

.mood-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.mood-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--pink-light);
  background: var(--card-bg);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
}
.mood-btn:active { transform: scale(0.95); }
.mood-btn.selected {
  border-color: var(--pink-primary);
  background: #FFF5F7;
  font-weight: 600;
}

/* --- Countdown Card --- */
.countdown-card {
  text-align: center;
  padding: 22px 18px;
  background: linear-gradient(135deg, #FFF9F0, #FFF0F3);
}

.countdown-icon { font-size: 2rem; margin-bottom: 4px; }

.countdown-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.countdown-days {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--pink-dark);
  line-height: 1.2;
}

.countdown-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* --- Love Quote --- */
.love-quote-card { text-align: center; padding: 16px; }
.love-quote {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.6;
}

/* --- Section Header --- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Buttons --- */
.btn-primary {
  background: var(--pink-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:active { background: var(--pink-dark); transform: scale(0.96); }

.btn-secondary {
  background: var(--pink-light);
  color: var(--pink-deep);
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* --- Dates List --- */
.dates-list { display: flex; flex-direction: column; gap: 10px; }

.date-item {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.date-info { flex: 1; }
.date-name { font-weight: 600; font-size: 0.95rem; }
.date-date-val { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

.date-countdown {
  text-align: right;
  margin-right: 10px;
}

.date-countdown-num {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--pink-dark);
}

.date-countdown-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-del {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--pink-light);
  color: var(--pink-dark);
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.btn-del:active { background: var(--pink-mid); }

.empty-hint {
  text-align: center;
  color: var(--text-muted);
  padding: 32px 16px;
  font-size: 0.85rem;
}

/* --- Messages --- */
.msg-composer {
  background: var(--card-bg);
  border-radius: var(--card-radius);
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}

.msg-composer textarea {
  width: 100%;
  border: 2px solid var(--pink-light);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: none;
  outline: none;
  color: var(--text-primary);
  background: #FFFAFB;
  transition: border-color 0.2s;
}
.msg-composer textarea:focus { border-color: var(--pink-primary); }

.msg-composer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.msg-btns { display: flex; gap: 6px; align-items: center; }
.btn-voice {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--pink-light); background: var(--card-bg);
  font-size: 1rem; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center;
}
.btn-voice:active { transform: scale(0.9); }
.btn-voice.recording {
  background: #E8507A; border-color: #E8507A; color: #fff;
  animation: pulse-voice 0.8s infinite;
}
@keyframes pulse-voice {
  0%,100% { box-shadow: 0 0 0 0 rgba(232,80,122,0.5); }
  50%     { box-shadow: 0 0 0 12px rgba(232,80,122,0); }
}
.voice-recording-hint {
  text-align: center; font-size: 0.78rem; color: #E8507A; margin-top: 6px; display: none;
}
.voice-recording-hint.active { display: block; }
.audio-msg { width: 100%; max-width: 250px; height: 40px; border-radius: 8px; }
.color-picker { display: flex; gap: 6px; }

.color-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.color-dot.active {
  border-color: var(--text-primary);
  transform: scale(1.15);
}
.color-dot:active { transform: scale(0.9); }

.messages-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg-note {
  padding: 14px 16px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
}

.msg-note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.msg-sender {
  font-size: 0.78rem;
  font-weight: 600;
}

.msg-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.msg-content {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
}

.msg-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 8px;
}

.msg-act-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  cursor: pointer;
}

.msg-edit-input {
  width: 100%;
  border: 2px solid var(--pink-primary);
  border-radius: 8px;
  padding: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 50px;
  outline: none;
}

.msg-edit-btns {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 6px;
}

/* --- Photos --- */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.photo-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.photo-card:active { transform: scale(0.97); }

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.photo-card-footer {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.photo-card-caption {
  font-size: 0.8rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-card-uploader {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 4px;
}

.photo-card.border-a { border: 2px solid var(--pink-mid); }
.photo-card.border-b { border: 2px solid #FFD700; }

/* --- Photo Preview --- */
.photo-preview { margin-top: 8px; text-align: center; }
.photo-preview img {
  max-width: 100%; max-height: 200px;
  border-radius: 10px;
}

/* --- Bottom Tab Bar --- */
.tab-bar {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--tab-bar-height);
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--pink-light);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.2s;
  min-width: 56px;
}

.tab-icon { font-size: 1.4rem; transition: transform 0.2s; }

.tab-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.2s;
}

.tab-btn.active .tab-icon { transform: scale(1.15); }
.tab-btn.active .tab-label { color: var(--pink-dark); font-weight: 700; }

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(80, 50, 60, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] { display: none; }

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

.modal-box {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 24px 20px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-box h2 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.modal-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 16px;
}

.modal-note {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin: 12px 0;
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="date"] {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--pink-light);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  color: var(--text-primary);
  background: #FFFAFB;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--pink-primary); }

.form-group input[type="file"] { font-size: 0.85rem; width: 100%; }

.identity-select { display: flex; gap: 10px; }

.identity-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--pink-light);
  background: var(--card-bg);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.identity-btn.selected {
  border-color: var(--pink-primary);
  background: #FFF5F7;
  font-weight: 700;
}
.identity-btn:active { transform: scale(0.96); }

.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* --- Password Gate --- */
.gate-box { text-align: center; }
.gate-illustration { font-size: 2.5rem; margin-bottom: 10px; }
.gate-hint { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 14px; }
.gate-error { font-size: 0.78rem; color: #E8507A; min-height: 20px; margin-top: 6px; }
#gate-password {
  width: 100%; padding: 12px; border: 2px solid var(--pink-light); border-radius: 12px;
  font-size: 1rem; text-align: center; outline: none; letter-spacing: 4px;
  background: #FFFAFB; font-family: inherit;
}
#gate-password:focus { border-color: var(--pink-primary); }
#modal-gate .modal-overlay { display: flex !important; }

/* --- Photo Viewer --- */
.photo-viewer-box {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 12px;
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  animation: slideUp 0.3s ease;
}

.photo-viewer-box img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 10px;
  display: block;
}

.photo-viewer-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  z-index: 1;
}

.photo-viewer-caption { font-size: 0.95rem; color: var(--text-primary); margin-top: 10px; text-align: center; }
.photo-viewer-meta { font-size: 0.75rem; color: var(--text-muted); text-align: center; margin-top: 2px; }

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%) translateY(-120px);
  background: var(--text-primary);
  color: #fff;
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 300;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* --- Responsive --- */
@media (min-width: 481px) {
  .app {
    border-left: 1px solid var(--pink-light);
    border-right: 1px solid var(--pink-light);
  }
  .photos-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 360px) {
  .photos-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .mood-picker { gap: 4px; }
  .mood-btn { padding: 4px 8px; font-size: 0.72rem; }
}
