/* ============================================================
   Rere OS · Components
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  color: var(--text-dark);
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  background-attachment: fixed;
}

button, input, textarea { font-family: inherit; color: inherit; outline: none; }
button { background: none; border: none; cursor: pointer; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ============================================================
   App 容器
   ============================================================ */
#app {
  position: fixed;
  inset: 0;
  max-width: 460px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
}

/* 屏幕周边的柔和高光 */
#app::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -20%;
  right: -20%;
  height: 50%;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,.5), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   Glass Card
   ============================================================ */
.glass {
  background: var(--glass-card);
  border: 1px solid var(--border-white);
  border-radius: var(--r-lg);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
}

.card {
  background: var(--card-bg);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-floating);
}

.card-soft {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
}

/* ============================================================
   Topbar (问候 + 天气)
   ============================================================ */
.topbar {
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px 8px;
}

.greeting-pill {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-floating);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--e-out);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.greeting-pill:active { transform: scale(0.97); }
.greeting-pill .date {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  flex-shrink: 0;
}

.weather-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--glass-card-hi);
  border-radius: var(--r-lg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--e-out);
  border: 1px solid var(--border-white);
}
.weather-pill:active { transform: scale(0.95); }
.weather-pill .icon { font-size: 14px; line-height: 1; }

/* ============================================================
   Mood bar (心情显示)
   ============================================================ */
.mood-bar {
  position: relative;
  z-index: 4;
  padding: 0 20px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mood-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--mood-color, var(--secondary));
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(255, 107, 107, 0.25);
}
.mood-tag .emoji { font-size: 12px; }

.card-title-center {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.2em;
}

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 220px;
  transform: translate(-50%, 20px);
  background: rgba(74, 43, 41, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  transition: all var(--dur-mid) var(--e-out);
  z-index: 9999;
  pointer-events: none;
  max-width: 80%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  backdrop-filter: blur(20px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   Mask / 蒙层
   ============================================================ */
.mask {
  position: fixed;
  inset: 0;
  background: rgba(74, 43, 41, 0.35);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-mid);
  z-index: 100;
}
.mask.show { opacity: 1; pointer-events: auto; }

/* ============================================================
   Button
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--r-lg);
  font-size: 13px;
  font-weight: 600;
  background: var(--card-bg);
  color: var(--text-dark);
  transition: transform var(--dur-fast) var(--e-out), box-shadow var(--dur-fast);
  box-shadow: var(--shadow-soft);
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.35);
}
.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-light);
}

/* ============================================================
   Scroll behavior
   ============================================================ */
.scroll-y {
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.scroll-y::-webkit-scrollbar { display: none; }
.scroll-x {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.scroll-x::-webkit-scrollbar { display: none; }

/* ============================================================
   Spinner
   ============================================================ */
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 107, 107, 0.2);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Boot 启动动画
   ============================================================ */
#boot {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  transition: opacity 0.6s var(--e-out);
}
#boot.gone { opacity: 0; pointer-events: none; }
#boot .logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
  position: relative;
  animation: logo-pulse 1.6s var(--e-spring);
  display: flex;
  align-items: center;
  justify-content: center;
}
#boot .logo::after {
  content: '♡';
  color: #fff;
  font-size: 30px;
  margin-top: -2px;
}
@keyframes logo-pulse {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
#boot .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
  letter-spacing: 0.4em;
  opacity: 0;
  animation: fade-up 0.6s var(--e-out) 0.5s forwards;
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
