/* ══ PAGE 0: PROFILE — 个人档案 ══ */
#p-profile {
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  background-color: transparent;
}
#p-profile::-webkit-scrollbar { width: 3px; }
#p-profile::-webkit-scrollbar-track { background: transparent; }
#p-profile::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }

/* ── Topbar ── */
#profile-topbar {
  position: sticky; top: 0; z-index: 20;
  padding: max(env(safe-area-inset-top), 14px) 24px 0;
  background: linear-gradient(to bottom, #050810ee 60%, transparent);
  pointer-events: none;
}
#profile-topbar-row {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 12px;
  max-width: 980px; margin: 0 auto;
  pointer-events: auto;
}
#btn-profile-back {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  color: var(--text-primary); font-size: 17px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0 0 1px 1px;
  transition: background .15s; flex-shrink: 0;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#btn-profile-back::before {
  content: ''; position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
}
#btn-profile-back:active { background: rgba(255,255,255,.12); }
#profile-topbar-title {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  color: var(--text-primary);
}

/* ── Hero: Avatar + Name ── */
#profile-hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 24px 0;
  max-width: 980px; margin: 0 auto;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.1s;
}
#profile-avatar-wrap {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.25s;
  position: relative;
}
#profile-avatar-wrap:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  transform: scale(1.05);
}
#profile-avatar-wrap:active { transform: scale(0.96); }
#profile-avatar {
  font-size: 42px; line-height: 1;
  filter: saturate(0.85);
}
#profile-name {
  font-family: var(--serif); font-size: 22px; font-weight: 600;
  color: var(--text-primary);
  margin-top: 14px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
#profile-name:hover { background: rgba(255,255,255,0.05); }
#profile-name-hint {
  font-family: var(--mono); font-size: 10px; font-weight: 300;
  letter-spacing: .1em; color: var(--text-muted);
  margin-top: 4px;
}

/* ── Stats Row ── */
#profile-stats {
  position: relative; z-index: 1;
  max-width: 980px; margin: 28px auto 0; padding: 0 24px;
  display: flex; justify-content: center; gap: 0;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.2s;
}
.pf-stat {
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 0;
  position: relative;
}
.pf-stat + .pf-stat::before {
  content: '';
  position: absolute; left: 0; top: 20%; height: 60%;
  width: 1px; background: var(--border);
}
.pf-stat-num {
  font-family: var(--mono); font-size: 22px; font-weight: 400;
  color: var(--text-primary);
}
.pf-stat-label {
  font-family: var(--mono); font-size: 10px; font-weight: 300;
  letter-spacing: .1em; color: var(--text-muted); text-transform: uppercase;
}

/* ── Section Title ── */
.pf-section-title {
  font-family: var(--mono); font-size: 10px; font-weight: 300;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 14px;
}

/* ── Week Streak ── */
#profile-streak-row {
  position: relative; z-index: 1;
  max-width: 980px; margin: 28px auto 0; padding: 0 24px;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.3s;
}
#pf-week {
  display: flex; gap: 10px; justify-content: space-between;
}
.pf-day {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex: 1;
}
.pf-day-dot {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10px; font-weight: 400;
  color: var(--text-muted);
  transition: all 0.3s ease;
}
.pf-day-dot.today {
  border-color: rgba(198,168,75,0.3);
}
.pf-day-dot.active {
  background: rgba(198,168,75,0.15);
  border-color: rgba(198,168,75,0.4);
  color: #c6a84b;
  box-shadow: 0 0 12px rgba(198,168,75,0.2);
}
.pf-day-label {
  font-family: var(--mono); font-size: 9px; font-weight: 300;
  letter-spacing: .08em; color: var(--text-muted);
}

/* ── Category Progress Grid ── */
#profile-cat-section {
  position: relative; z-index: 1;
  max-width: 980px; margin: 28px auto 0; padding: 0 24px;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.4s;
}
#profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 600px) { #profile-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; } }

.pf-cat-card {
  position: relative; overflow: hidden;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px 14px 14px;
  display: flex; flex-direction: column;
  opacity: 0; animation: cardIn 0.45s ease forwards;
}
.pf-cat-aurora {
  position: absolute; top: -30px; right: -30px;
  width: 100px; height: 100px;
  border-radius: 50%; filter: blur(40px);
  opacity: 0.14; pointer-events: none;
}
.pf-cat-icon { font-size: 22px; margin-bottom: 8px; filter: saturate(0.85); }
.pf-cat-name {
  font-family: var(--serif); font-size: 14px; font-weight: 600;
  line-height: 1.2; margin-bottom: 10px;
}
.pf-cat-progress {
  position: relative; height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px; overflow: hidden; margin-bottom: 8px;
  margin-top: auto;
}
.pf-cat-progress-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  border-radius: 2px;
  transition: width 0.9s cubic-bezier(.16, 1, .3, 1);
  width: 0;
  min-width: 6px;
  opacity: 0.25;
}
.pf-cat-progress-fill.has-progress {
  opacity: 1;
}
.pf-cat-stat {
  font-family: var(--mono); font-size: 10px; font-weight: 300;
  letter-spacing: .04em; color: var(--text-tertiary);
}

/* ── Action Buttons ── */
#profile-actions {
  position: relative; z-index: 1;
  max-width: 980px; margin: 32px auto 0;
  padding: 0 24px max(env(safe-area-inset-bottom), 48px);
  display: flex; flex-direction: column; gap: 12px;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.5s;
}
.pf-action-btn {
  width: 100%; padding: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  font-family: var(--mono); font-size: 12px; font-weight: 400;
  letter-spacing: .08em; color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pf-action-btn:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}
.pf-action-btn:active { background: rgba(255,255,255,0.12); }
.pf-action-btn.pf-danger {
  color: #f06060;
  border-color: rgba(240,96,96,0.15);
}
.pf-action-btn.pf-danger:hover {
  background: rgba(240,96,96,0.08);
  border-color: rgba(240,96,96,0.3);
}
.pf-action-row {
  display: flex; gap: 12px;
}
.pf-action-row .pf-action-btn { flex: 1; }


.pf-reset-arrow {
  display: inline-block;
  transition: transform 0.3s ease;
}
#pf-btn-reset.pf-arrow-up .pf-reset-arrow {
  transform: rotate(180deg);
}

/* 面板打开时暗化上方内容 */
#p-profile.reset-panel-open #profile-hero,
#p-profile.reset-panel-open #profile-stats,
#p-profile.reset-panel-open #profile-streak-row,
#p-profile.reset-panel-open #profile-cat-section {
  opacity: 0.25;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ── Reset Panel (改为向上悬浮展开) ── */
#pf-reset-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease,
              margin-bottom 0.3s ease;
  margin-bottom: 0;
}
#pf-reset-panel.pf-reset-open {
  max-height: 800px;
  opacity: 1;
  margin-bottom: 12px;
}
#pf-reset-inner {
  background: rgb(10, 12, 18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 8px 0 8px;
  max-height: 45vh; overflow-y: auto;
  box-shadow:
    0 -4px 24px rgba(0,0,0,0.6),
    0 -8px 48px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.05);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 以上为悬浮展开版本 */


#pf-reset-inner::-webkit-scrollbar { display: none; }
.pf-reset-header {
  font-family: var(--mono); font-size: 10px; font-weight: 300;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 8px;
}
.pf-reset-divider {
  height: 1px; background: var(--border); margin: 4px 20px;
}
.pf-reset-row {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 14px 20px;
  background: none; border: none;
  cursor: pointer; color: var(--text-secondary);
  font-family: var(--sans); font-size: 14px;
  transition: background 0.15s;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pf-reset-row:active { background: rgba(255,255,255,0.06); }
.pf-reset-row.pf-danger-row { color: #f06060; }
.pf-reset-row.pf-danger-row:active { background: rgba(240,96,96,0.08); }
.pf-reset-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.pf-reset-text { flex: 1; }
.pf-reset-count {
  font-family: var(--mono); font-size: 11px;
  color: var(--text-muted); flex-shrink: 0;
}

/* 子主题展开 */
.pf-reset-cat { border-bottom: 1px solid rgba(255,255,255,0.03); }
.pf-reset-cat-header {
  display: flex; align-items: center; gap: 14px;
  width: 100%; padding: 13px 20px;
  background: none; border: none;
  cursor: pointer; color: var(--text-secondary);
  font-family: var(--sans); font-size: 14px;
  transition: background 0.15s;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pf-reset-cat-header:active { background: rgba(255,255,255,0.06); }
.pf-reset-chevron {
  font-size: 12px; color: var(--text-muted);
  transition: transform 0.25s;
  margin-left: auto; flex-shrink: 0;
}
.pf-reset-cat.expanded .pf-reset-chevron { transform: rotate(90deg); }
.pf-reset-themes {
  max-height: 0; overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.pf-reset-cat.expanded .pf-reset-themes { max-height: 600px; }
.pf-reset-theme-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px 10px 48px;
  cursor: pointer;
  font-family: var(--sans); font-size: 13px;
  color: var(--text-tertiary);
  transition: background 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pf-reset-theme-row:active { background: rgba(255,255,255,0.06); }
.pf-reset-theme-icon { font-size: 16px; flex-shrink: 0; }
.pf-reset-theme-name { flex: 1; }

/* ── Category cards clickable ── */
.pf-cat-card {
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(.34, 1.56, .64, 1), border-color 0.25s, background 0.25s;
}
.pf-cat-card:active { transform: scale(0.96); }
.pf-cat-card:hover {
  border-color: rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04);
  transform: translateY(-3px);
}

/* ── Avatar Picker ── */
#profile-avatar-picker {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,4,7,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: opacity 0.3s ease;
}
#profile-avatar-picker.pf-picker-hidden {
  opacity: 0; pointer-events: none;
  visibility: hidden;
}
#pf-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 24px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 22px;
  max-width: 280px;
}
.pf-picker-item {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  border-radius: 14px;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  border: 1px solid transparent;
}
.pf-picker-item:hover {
  background: rgba(255,255,255,0.08);
  transform: scale(1.1);
}
.pf-picker-item:active { transform: scale(0.92); }
.pf-picker-item.selected {
  border-color: rgba(198,168,75,0.5);
  background: rgba(198,168,75,0.12);
}

/* ── Home Avatar Button ── */
#home-header-top {
  display: flex; align-items: center; justify-content: space-between;
}
#btn-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  font-size: 20px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.25s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  position: relative;
  opacity: 0; animation: fadeUp 0.6s ease forwards 0.15s;
}
/* 扩大触控热区到 60x60 */
#btn-avatar::before {
  content: ''; position: absolute;
  top: -8px; left: -8px; right: -8px; bottom: -8px;
  z-index: 1;
}
#btn-avatar:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
}
#btn-avatar:active { transform: scale(0.92); }

/* ── Custom Modal ── */
#pf-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3,4,7,0);
  transition: background 0.25s ease;
  padding: 24px;
}
#pf-modal.pf-modal-in { background: rgba(3,4,7,0.7); }
#pf-modal.pf-modal-out { background: rgba(3,4,7,0); }
.pf-modal-card {
  background: rgba(18,20,28,0.95);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 24px 20px;
  max-width: 340px; width: 100%;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: scale(0.9); opacity: 0;
  transition: transform 0.3s cubic-bezier(.16,1,.3,1), opacity 0.25s ease;
}
.pf-modal-in .pf-modal-card { transform: scale(1); opacity: 1; }
.pf-modal-out .pf-modal-card { transform: scale(0.9); opacity: 0; }
.pf-modal-title {
  font-family: var(--serif); font-size: 17px; font-weight: 600;
  color: var(--text-primary); margin-bottom: 10px;
}
.pf-modal-body {
  font-size: 13px; line-height: 1.6;
  color: var(--text-secondary); margin-bottom: 20px;
}
.pf-modal-body strong { color: var(--text-primary); font-weight: 600; }
.pf-modal-btns {
  display: flex; gap: 10px; justify-content: flex-end;
}
.pf-modal-btn {
  padding: 8px 18px; border-radius: 10px;
  font-family: var(--mono); font-size: 12px; font-weight: 400;
  letter-spacing: .05em;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.pf-modal-btn:hover { background: rgba(255,255,255,0.1); }
.pf-modal-btn.pf-modal-primary {
  background: rgba(198,168,75,0.15);
  border-color: rgba(198,168,75,0.3);
  color: #c6a84b;
}
.pf-modal-btn.pf-modal-primary:hover { background: rgba(198,168,75,0.25); }
.pf-modal-btn.pf-modal-danger {
  background: rgba(240,96,96,0.1);
  border-color: rgba(240,96,96,0.2);
  color: #f06060;
}
.pf-modal-btn.pf-modal-danger:hover { background: rgba(240,96,96,0.2); }
