/* ==========================================================================
   Little Red Flowers App CSS Stylesheet
   Child-Friendly, Responsive, Vibrant, Modern Micro-interactions
   ========================================================================== */

/* Design Tokens & Theme Setup */
:root {
  --font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Color Palette - Vibrant Pastel/Dopamine colors for kids */
  --primary: #4a90e2;
  /* Cute Sky Blue */
  --primary-light: #e6effc;
  --secondary: #ff9f43;
  /* Warm Orange */
  --secondary-light: #fff3e6;
  --success: #2ecc71;
  /* Fresh Green */
  --success-light: #eafaf1;
  --danger: #ff5252;
  /* Sweet Red */
  --danger-light: #ffebee;
  --flower-active: #ff4b5c;
  /* Pop Red Flower Color */
  --flower-inactive: #e0e5eb;
  /* Grey Flower */

  --dark-text: #2c3e50;
  --light-text: #7f8c8d;
  --border-color: #e2e8f0;

  /* Backgrounds */
  --app-bg: #ebf3fb;
  --card-bg: #ffffff;
  --panel-bg: #f8fafc;

  /* Shadows & Radius */
  --card-radius: 24px;
  --btn-radius: 16px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(74, 144, 226, 0.12), 0 4px 6px -2px rgba(74, 144, 226, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(74, 144, 226, 0.18), 0 10px 10px -5px rgba(74, 144, 226, 0.06);

  /* Transitions */
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base Reset & Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  background-color: var(--app-bg);
  color: var(--dark-text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* Scrollbar styling for a cleaner look */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Device Mockup Wrapper for Desktop, Fullscreen on Mobile */
.app-container {
  width: 100vw;
  height: 100vh;
  background-color: var(--card-bg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}


/* ==========================================================================
   Header Styles
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, #357abd 100%);
  color: #ffffff;
  padding: 24px 20px 20px;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  box-shadow: var(--shadow-md);
  z-index: 10;
  flex-shrink: 0;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.avatar-container {
  width: 60px;
  height: 60px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 32px;
  box-shadow: var(--shadow-sm);
  border: 3px solid rgba(255, 255, 255, 0.4);
}

.user-info h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 2px;
}

.family-code-badge {
  font-size: 14px;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-block;
  backdrop-filter: blur(4px);
}

/* Stats Row Dashboard */
.stats-dashboard {
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 12px 15px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--dark-text);
}

.stat-card {
  text-align: center;
  flex: 1;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--flower-active);
  margin-bottom: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
}

.stat-value::before {
  content: '🌸';
  font-size: 16px;
}

.stat-label {
  font-size: 14px;
  color: var(--light-text);
}

.stat-divider {
  width: 1px;
  height: 30px;
  background-color: var(--border-color);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background-color: #f7fafc;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.3s ease;
  height: auto;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   Tab 1: 自律表 (Weekly Checkin) Styles
   ========================================================================== */
.week-picker {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
}

.picker-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.picker-btn:hover {
  background-color: var(--primary-light);
}

.week-info {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.month-year-label {
  font-size: 14px;
  color: var(--light-text);
  text-transform: uppercase;
}

.week-number-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-text);
}

/* Calendar Header Grid */
.calendar-grid-header {
  display: grid;
  grid-template-columns: 2.2fr repeat(7, 1fr);
  gap: 4px;
  background-color: var(--card-bg);
  border-radius: 16px 16px 0 0;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
  box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

.col-habit-title {
  text-align: left;
  padding-left: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--light-text);
  display: flex;
  align-items: center;
}

.col-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 4px 0;
}

.col-day span {
  font-size: 14px;
  font-weight: 600;
  color: var(--light-text);
}

.col-day em {
  font-size: 14px;
  font-style: normal;
  color: var(--dark-text);
}

.col-day.today {
  background-color: var(--primary-light);
}

.col-day.today span {
  color: var(--primary);
}

.col-day.today em {
  color: var(--primary);
  font-weight: 600;
}

/* Checkin Rows */
.checkin-container {
  background-color: var(--card-bg);
  border-radius: 0 0 16px 16px;
  padding: 8px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 24px;
}

.checkin-row {
  display: grid;
  grid-template-columns: 2.2fr repeat(7, 1fr);
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px dashed #f1f5f9;
  align-items: center;
  transition: var(--transition-fast);
}

.checkin-row:last-child {
  border-bottom: none;
}

.habit-name-col {
  padding-left: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
  line-height: 1.3;
}

/* Interactive Flower Button */
.flower-btn {
  background: none;
  border: none;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 8px;
  transition: var(--transition-fast);
  position: relative;
}

.flower-btn:hover {
  background-color: #f8fafc;
}

.flower-svg {
  width: 26px;
  height: 26px;
  fill: var(--flower-inactive);
  transition: var(--transition-spring);
}

/* Active State */
.flower-btn.active .flower-svg {
  fill: var(--flower-active);
  filter: drop-shadow(0 2px 4px rgba(255, 75, 92, 0.4));
  transform: scale(1.1) rotate(10deg);
  animation: pop-bounce 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.5) forwards;
}

/* Interactive Pop Animation */
@keyframes pop-bounce {
  0% {
    transform: scale(0.5) rotate(-30deg);
  }

  50% {
    transform: scale(1.4) rotate(15deg);
  }

  75% {
    transform: scale(0.95) rotate(-5deg);
  }

  100% {
    transform: scale(1.1) rotate(10deg);
  }
}

/* Flower burst particles effect wrapper */
.particle {
  position: absolute;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  width: 4px;
  height: 4px;
}

/* ==========================================================================
   Tab 2: 习惯管理 (Habit Management) Styles
   ========================================================================== */
.section-title-wrapper {
  margin-bottom: 10px;
}

.mt-lg {
  margin-top: 24px;
}

.mt-md {
  margin-top: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-text);
}

.section-desc {
  font-size: 14px;
  color: var(--light-text);
}

.habits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.habit-item-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
  transition: var(--transition-fast);
}

.habit-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.drag-handle {
  color: var(--light-text);
  cursor: grab;
  font-size: 14px;
}

.habit-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
}

.remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 18px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-fast);
}

.remove-btn:hover {
  background-color: var(--danger-light);
}


/* Custom form inputs */
.custom-card {
  background-color: var(--card-bg);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--light-text);
}

.form-group.row-group {
  flex-direction: row;
  gap: 8px;
}

.form-group.row-group input {
  flex: 1;
}

input[type="text"],
input[type="number"],
input[type="password"] {
  border: 1px solid var(--border-color);
  background-color: #f8fafc;
  padding: 12px 16px;
  border-radius: var(--btn-radius);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

/* Buttons */
.btn {
  border: none;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--btn-radius);
  cursor: pointer;
  transition: var(--transition-spring);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 6px rgba(74, 144, 226, 0.2);
}

.btn-primary:hover {
  background-color: #357abd;
}

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary-light);
}

.btn-outline-secondary {
  background-color: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--dark-text);
  font-size: 14px;
  padding: 8px 14px;
}

.btn-outline-secondary:hover {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 6px rgba(255, 82, 82, 0.2);
}

.btn-danger:hover {
  background-color: #e33e3e;
}

.btn-round {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background-color: var(--success);
  color: white;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.3);
  transition: var(--transition-spring);
}

.btn-round:hover {
  transform: scale(1.1) rotate(90deg);
  background-color: #27ae60;
}

/* ==========================================================================
   Tab 3: 愿望清单 (Wishes) Styles
   ========================================================================== */
.wishes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.wishes-title-area {
  display: flex;
  flex-direction: column;
}

.wishes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.wish-card {
  background-color: var(--card-bg);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 14px;
  align-items: center;
  position: relative;
  transition: var(--transition-normal);
}

.wish-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.wish-icon-box {
  width: 50px;
  height: 50px;
  background-color: #f1f5f9;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  flex-shrink: 0;
}

.wish-details {
  flex: 1;
  min-width: 0;
  /* Ensures text truncation works */
}

.wish-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.wish-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wish-description {
  font-size: 14px;
  color: var(--light-text);
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Progress bar */
.wish-progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wish-progress-bar {
  flex: 1;
  height: 8px;
  background-color: #f1f5f9;
  border-radius: 4px;
  overflow: hidden;
}

.wish-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffc048, #ff9f43);
  border-radius: 4px;
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.wish-progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--light-text);
  white-space: nowrap;
}

/* Redeem Button on Wish Card */
.redeem-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background-color: var(--flower-inactive);
  color: #a0aec0;
  font-size: 14px;
  font-weight: 600;
  cursor: not-allowed;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  transition: var(--transition-spring);
}

.wish-card.claimable .redeem-btn {
  background-color: var(--secondary);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 159, 67, 0.3);
}

.wish-card.claimable .redeem-btn:hover {
  transform: scale(1.1);
  background-color: #f39c12;
}

.wish-card.claimable .redeem-btn:active {
  transform: scale(0.95);
}

.wish-card.claimed-card {
  opacity: 0.7;
}

.wish-card.claimed-card .wish-progress-fill {
  background: #cbd5e1;
}

.wish-card.claimed-card .redeem-btn {
  background-color: var(--success);
  color: white;
  cursor: default;
  font-size: 14px;
}

.wish-card .delete-wish-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: none;
  border: none;
  color: var(--light-text);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.wish-card:hover .delete-wish-btn {
  opacity: 1;
}

/* ==========================================================================
   Tab 4: 设置 (Settings) Styles
   ========================================================================== */
.card {
  background-color: var(--card-bg);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.settings-card {
  display: flex;
  flex-direction: column;
}

.card-title-icon {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-intro {
  font-size: 14px;
  color: var(--light-text);
  margin-bottom: 14px;
  line-height: 1.4;
}

.border-danger {
  border-color: rgba(255, 82, 82, 0.3);
}

.text-danger {
  color: var(--danger) !important;
}

/* Avatar grid selector */
.avatar-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  justify-items: center;
  gap: 6px;
  margin-top: 4px;
}

.avatar-option {
  font-size: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: var(--transition-fast);
}

.avatar-option:hover {
  background-color: #f1f5f9;
}

.avatar-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: scale(1.1);
}

/* Emoji selector inside modal */
.emoji-selector {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 4px;
}

.emoji-option {
  font-size: 24px;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 12px;
  border: 2px solid transparent;
  background-color: #f8fafc;
  transition: var(--transition-fast);
}

.emoji-option:hover {
  background-color: #e2e8f0;
}

.emoji-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: scale(1.05);
}

/* Toggle Switch Component */
.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--success);
}

input:focus+.slider {
  box-shadow: 0 0 1px var(--success);
}

input:checked+.slider:before {
  transform: translateX(22px);
}

.toggle-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
}

.input-tip {
  font-size: 14px;
  color: var(--light-text);
  margin-top: -2px;
}

.sync-actions-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.sync-log {
  font-size: 14px;
  color: var(--light-text);
  background-color: #f8fafc;
  padding: 8px 12px;
  border-radius: 10px;
  border-left: 3px solid #cbd5e1;
  word-break: break-all;
}

.backup-actions {
  display: flex;
  gap: 8px;
}

.backup-actions button {
  flex: 1;
}

/* ==========================================================================
   Bottom Navigation Bar Styles
   ========================================================================== */
.app-navbar {
  height: 64px;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.02);
  flex-shrink: 0;
  z-index: 10;
}

.nav-item {
  background: none;
  border: none;
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #94a3b8;
  cursor: pointer;
  transition: var(--transition-fast);
  gap: 3px;
}

.nav-icon {
  font-size: 20px;
  transition: var(--transition-spring);
}

.nav-label {
  font-size: 14px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px) scale(1.15);
}

/* ==========================================================================
   Modal Overlay and Containers
   ========================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(44, 62, 80, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  /* Slides up from bottom like WeChat */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  width: 100%;
  background-color: var(--card-bg);
  border-top-left-radius: 30px;
  border-top-right-radius: 30px;
  padding: 24px;
  box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.1);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.modal-overlay.open .modal-container {
  transform: translateY(0);
}

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

.modal-header h4 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--light-text);
  cursor: pointer;
}

.modal-body {
  margin-bottom: 24px;
  max-height: 50vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: 12px;
}

.modal-footer button {
  flex: 1;
}

/* ==========================================================================
   Global Toast Notifications
   ========================================================================== */
.toast {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: rgba(44, 62, 80, 0.95);
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}

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

/* Empty State Styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--light-text);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Floating Hearts Animation for Pet Tab
   ========================================================================== */
.hearts-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.floating-heart {
  position: absolute;
  bottom: -30px;
  font-size: 20px;
  opacity: 0;
  animation: floatUp 4s ease-in-out infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0;
  }

  20% {
    opacity: 0.8;
  }

  80% {
    opacity: 0.8;
  }

  100% {
    transform: translateY(-500px) scale(1.2);
    opacity: 0;
  }
}

.heart-0 {
  left: 10%;
  animation-duration: 4.5s;
  animation-delay: 0s;
  font-size: 32px;
}

.heart-1 {
  left: 35%;
  animation-duration: 5s;
  animation-delay: 1.2s;
  font-size: 48px;
}

.heart-2 {
  left: 55%;
  animation-duration: 4.2s;
  animation-delay: 2.1s;
  font-size: 36px;
}

.heart-3 {
  left: 75%;
  animation-duration: 5.5s;
  animation-delay: 0.5s;
  font-size: 44px;
}

.heart-4 {
  left: 85%;
  animation-duration: 4.8s;
  animation-delay: 3.5s;
  font-size: 28px;
}

.heart-5 {
  left: 5%;
  animation-duration: 5.8s;
  animation-delay: 2.8s;
  font-size: 40px;
}

.heart-6 {
  left: 25%;
  animation-duration: 4.3s;
  animation-delay: 1.5s;
  font-size: 30px;
}

.heart-7 {
  left: 45%;
  animation-duration: 6.1s;
  animation-delay: 0.8s;
  font-size: 46px;
}

.heart-8 {
  left: 65%;
  animation-duration: 4.7s;
  animation-delay: 3.2s;
  font-size: 24px;
}

.heart-9 {
  left: 95%;
  animation-duration: 5.9s;
  animation-delay: 1.9s;
  font-size: 50px;
}

.heart-10 {
  left: 20%;
  animation-duration: 5.4s;
  animation-delay: 4.1s;
  font-size: 38px;
}

.heart-11 {
  left: 80%;
  animation-duration: 6.8s;
  animation-delay: 0.3s;
  font-size: 26px;
}

/* ==========================================================================
   Floating Clouds Animation for Pet Tab
   ========================================================================== */
.clouds-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120px;
  pointer-events: none;
  overflow: hidden;
  z-index: 2;
}

.floating-cloud {
  position: absolute;
  opacity: 0.8;
  animation: floatCloud linear infinite;
  filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.5));
  transform: scale(1.3, 0.8);
}

@keyframes floatCloud {
  0% {
    left: 100%;
  }

  100% {
    left: -30%;
  }
}

.cloud-0 {
  top: 10px;
  animation-duration: 20s;
  animation-delay: 0s;
  font-size: 40px;
}

.cloud-1 {
  top: 40px;
  animation-duration: 30s;
  animation-delay: -10s;
  font-size: 55px;
  opacity: 0.6;
}

.cloud-2 {
  top: 20px;
  animation-duration: 25s;
  animation-delay: -15s;
  font-size: 35px;
  opacity: 0.9;
}

.cloud-3 {
  top: 5px;
  animation-duration: 35s;
  animation-delay: -5s;
  font-size: 60px;
  opacity: 0.5;
}

/* ==========================================================================
   Sync Code Modal (Bottom Sheet - replaces native prompt)
   ========================================================================== */
.sync-modal-overlay {
  z-index: 200;
}

.sync-modal-container {
  padding: 16px 24px 32px;
  padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.sync-modal-grip {
  width: 44px;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  margin: 0 auto 20px;
}

.sync-modal-header {
  text-align: center;
  margin-bottom: 22px;
}

.sync-modal-flower-ring {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #fff0f6, #ffe5ef);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(255, 75, 130, 0.15);
  animation: floatBob 3s ease-in-out infinite;
}

@keyframes floatBob {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-6px);
  }
}

.sync-modal-icon {
  font-size: 38px;
}

.sync-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--dark-text);
  margin-bottom: 8px;
}

.sync-modal-desc {
  font-size: 14px;
  color: var(--light-text);
  line-height: 1.6;
}

.sync-modal-hint {
  color: var(--primary);
  font-weight: 600;
}

.sync-modal-input-group {
  margin-bottom: 16px;
}

.sync-modal-input-group label {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--dark-text);
  margin-bottom: 8px;
}

.sync-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.sync-input-wrapper input {
  width: 100%;
  padding-right: 44px;
  font-weight: 600;
  letter-spacing: 1px;
}

.sync-eye-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  color: var(--light-text);
  transition: var(--transition-fast);
}

.sync-eye-btn:hover {
  transform: scale(1.1);
}

.sync-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 12px;
  background: var(--panel-bg);
  border-radius: 10px;
}

.sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.sync-status-dot.valid {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.2);
}

.sync-status-text {
  font-size: 14px;
  color: var(--light-text);
  line-height: 1.4;
}

.sync-modal-footer {
  gap: 10px;
}

.sync-confirm-btn {
  font-size: 15px;
}

/* ==========================================================================
   Daily Quote Card
   ========================================================================== */
.daily-quote-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #fffde7 0%, #fff8e1 100%);
  border: 1.5px solid #ffe082;
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(255, 193, 7, 0.12);
  position: relative;
  overflow: hidden;
}

.daily-quote-card::before {
  content: '"';
  position: absolute;
  left: 6px;
  top: -8px;
  font-size: 52px;
  color: rgba(255, 193, 7, 0.18);
  font-family: Georgia, serif;
  line-height: 1;
  pointer-events: none;
}

.quote-emoji {
  font-size: 24px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.quote-text {
  font-size: 14px;
  font-weight: 600;
  color: #5c4a00;
  line-height: 1.5;
  flex: 1;
}

/* ==========================================================================
   Weather Badge
   ========================================================================== */
.weather-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-text);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.pet-action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
  flex-shrink: 0;
}

.pet-feed-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: white;
  border: none;
  border-radius: 24px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(238, 90, 36, 0.3);
  transition: var(--transition-spring);
  white-space: nowrap;
  flex-shrink: 0;
}

.pet-feed-btn:hover:not(.disabled) {
  transform: scale(1.06) translateY(-1px);
  box-shadow: 0 6px 16px rgba(238, 90, 36, 0.4);
}

.pet-feed-btn:active:not(.disabled) {
  transform: scale(0.96);
}

.pet-feed-btn.disabled {
  background: #e0e5eb;
  color: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

.feed-btn-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.hat-selector {
  display: flex;
  gap: 7px;
  flex: 1;
  justify-content: flex-end;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.hat-selector::-webkit-scrollbar {
  display: none;
}

.hat-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2.5px solid var(--border-color);
  background: white;
  font-size: 19px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-spring);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.hat-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.12) translateY(-2px);
  box-shadow: var(--shadow-md);
}

.hat-btn.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary), #357abd);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.35);
  transform: scale(1.12) translateY(-2px);
}

.hat-btn.active::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  background: var(--primary);
  border-radius: 50%;
}

/* ==========================================================================
   Panda Warrior Growth System
   ========================================================================== */
.warrior-tab {
  min-height: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 86px;
}

.warrior-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.warrior-title-row .section-desc {
  margin-top: 4px;
}

.warrior-rank-badge {
  flex-shrink: 0;
  min-width: 54px;
  padding: 6px 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, #e0efff, #f5f9ff);
  color: #245f9f;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.warrior-quote-card {
  margin-bottom: 0;
  border-color: #ffd66b;
  background: linear-gradient(135deg, #fff8d9, #fffdf3);
}

.warrior-level-card {
  padding: 14px;
  border: 1px solid rgba(67, 116, 160, 0.13);
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff, #f5f9ff);
  box-shadow: 0 8px 20px rgba(31, 67, 102, 0.09);
}

.warrior-level-card-compact {
  padding: 12px 14px;
}

.warrior-level-card-compact .warrior-progress-meta {
  margin-top: 9px;
}

.warrior-level-top,
.warrior-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.warrior-level-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.warrior-level-shield {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #dbeafe, #eff6ff);
  font-size: 22px;
}

.warrior-level-identity div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.warrior-level-identity strong {
  color: #234567;
  font-size: 16px;
}

.warrior-level-identity span {
  overflow: hidden;
  color: #7790a8;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warrior-mood {
  flex-shrink: 0;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
}

.warrior-mood.great {
  background: #fff0e5;
  color: #e35b1c;
}

.warrior-mood.ready {
  background: #e8f3ff;
  color: #2f72b7;
}

.warrior-mood.charging {
  background: #edf1f5;
  color: #65788c;
}

.warrior-progress-meta {
  margin-top: 12px;
  color: #71869b;
  font-size: 14px;
}

.warrior-progress-meta strong {
  color: #315f8e;
}

.warrior-progress-track {
  height: 11px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe9f4;
  box-shadow: inset 0 2px 4px rgba(30, 64, 96, 0.08);
}

.warrior-progress-value {
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, var(--stage-color));
  box-shadow: 0 0 12px var(--stage-glow);
  transition: width 0.45s ease;
}

.warrior-next-unlock {
  margin-top: 9px;
  color: #657b90;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.warrior-next-unlock strong {
  color: #e88a16;
}

.warrior-loadout {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.warrior-slot {
  min-width: 0;
  padding: 8px 5px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px solid #d9e5f1;
  border-radius: 15px;
  background: linear-gradient(145deg, #ffffff, #f0f6fc);
  box-shadow: 0 5px 12px rgba(31, 67, 102, 0.07);
}

.warrior-slot.locked {
  opacity: 0.62;
  filter: grayscale(0.75);
}

.warrior-slot-label {
  color: #7a91a7;
  font-size: 14px;
  font-weight: 700;
}

.warrior-slot-icon {
  font-size: 25px;
  line-height: 1.1;
  filter: drop-shadow(0 3px 4px rgba(22, 46, 69, 0.14));
}

.warrior-slot-name {
  width: 100%;
  min-height: 34px;
  display: -webkit-box;
  overflow: hidden;
  color: #35516c;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.warrior-scene {
  min-height: 390px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(85, 134, 178, 0.25);
  border-radius: 22px;
  background: #102747;
  box-shadow:
    0 14px 28px rgba(16, 39, 71, 0.2),
    0 0 22px var(--stage-glow);
}

.warrior-scene-label {
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 24, 44, 0.72);
  color: #d8eaff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.warrior-scene-label span:last-child {
  color: #ffd75e;
}

.warrior-canvas-wrap {
  position: relative;
  min-height: 300px;
  flex: 1;
  overflow: hidden;
}

.warrior-canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 48%, transparent 28%, rgba(5, 17, 31, 0.22) 100%),
    linear-gradient(180deg, rgba(111, 182, 255, 0.05), transparent 35%);
}

.warrior-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

.warrior-action-panel {
  min-height: 66px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(16, 38, 65, 0.98), rgba(26, 60, 96, 0.98));
}

.warrior-battle-message {
  min-width: 0;
  flex: 1;
  color: #d6e8fa;
  font-size: 14px;
  line-height: 1.35;
}

.warrior-train-btn {
  min-height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 1px solid #ffcf56;
  border-radius: 14px;
  background: linear-gradient(135deg, #ffb82e, #ed7518);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(238, 117, 24, 0.36);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.warrior-train-btn:active {
  transform: scale(0.95);
  box-shadow: 0 3px 8px rgba(238, 117, 24, 0.28);
}

.warrior-train-btn span {
  font-size: 20px;
}

@media (max-width: 370px) {
  .warrior-level-top {
    align-items: flex-start;
  }

  .warrior-mood {
    padding: 5px 7px;
  }

  .warrior-loadout {
    gap: 5px;
  }

  .warrior-slot {
    padding-inline: 3px;
  }

  .warrior-action-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .warrior-train-btn {
    width: 100%;
  }
}

/* ==========================================================================
   Weather Info Bar (今日天气横条)
   ========================================================================== */
.weather-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92) 0%, rgba(240, 248, 255, 0.92) 100%);
  border: 1.5px solid rgba(74, 144, 226, 0.15);
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.08);
  backdrop-filter: blur(6px);
}

.weather-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.weather-info-icon {
  font-size: 26px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  animation: weatherSpin 6s linear infinite;
}

@keyframes weatherSpin {

  0%,
  85% {
    transform: rotate(0deg) scale(1);
  }

  90% {
    transform: rotate(-15deg) scale(1.1);
  }

  95% {
    transform: rotate(15deg) scale(1.1);
  }

  100% {
    transform: rotate(0deg) scale(1);
  }
}

.weather-info-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.weather-info-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dark-text);
  line-height: 1.3;
}

.weather-info-sub {
  font-size: 14px;
  color: var(--light-text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-info-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 10px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
