/* =========================================================
   style.css · 布局与组件样式
   ---------------------------------------------------------
   目录：
   01. 基础重置与全局
   02. 背景装饰层（渐变底 + 漂浮光斑）
   03. 页面容器
   04. 玻璃卡片基础样式
   05. 顶部标题栏与主题切换按钮
   06. 状态卡片（头像 / 徽章 / 文案 / 时间）
   07. 管理面板（状态选择 + 文案编辑）
   08. 卡片右上角锁定按钮
   09. 访问统计卡片
   10. 页脚
   11. 管理密码弹窗
   12. Toast 轻提示
   13. 入场动画
   14. 关键帧定义
   15. 响应式适配
   16. 无障碍：尊重系统"减弱动态效果"
   ========================================================= */

/* ========== 01. 基础重置与全局 ========== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;   /* 苹果系字体平滑 */
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: color var(--dur-theme) ease; /* 主题切换时文字颜色平滑过渡 */
}

button, input { font-family: inherit; }

/* 文本选中色跟随强调色 */
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }

/* 键盘可达性：焦点环 */
:where(button, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ========== 02. 背景装饰层 ========== */
/* .bg 固定全屏，双渐变底通过透明度交叉淡入实现平滑换肤 */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-base {
  position: absolute;
  inset: 0;
  transition: opacity 0.7s ease;
}

/* 浅色底：清晨雾蓝 → 淡紫 */
.bg-light {
  background: linear-gradient(160deg, #f0f3fa 0%, #e3e9f7 55%, #eae2f7 100%);
  opacity: 1;
}

/* 暗色底：深夜蓝黑 → 暗紫 */
.bg-dark {
  background: linear-gradient(160deg, #0a0b14 0%, #101224 60%, #141027 100%);
  opacity: 0;
}

html[data-theme="dark"] .bg-light { opacity: 0; }
html[data-theme="dark"] .bg-dark  { opacity: 1; }

/* 漂浮光斑：大模糊 + 慢速漂移，营造"液态玻璃"的氛围底色 */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: var(--blob-opacity);
  transition: background-color 0.8s ease, opacity 0.8s ease;
  will-change: transform;
}

.blob-1 {
  width: 46vmax; height: 46vmax;
  top: -14%; left: -12%;
  background: var(--blob-1);
  animation: drift-a 24s ease-in-out infinite alternate;
}

.blob-2 {
  width: 38vmax; height: 38vmax;
  top: 30%; right: -14%;
  background: var(--blob-2);
  animation: drift-b 28s ease-in-out infinite alternate;
}

.blob-3 {
  width: 34vmax; height: 34vmax;
  bottom: -16%; left: 16%;
  background: var(--blob-3);
  animation: drift-c 32s ease-in-out infinite alternate;
}

.blob-4 {
  width: 24vmax; height: 24vmax;
  top: 6%; right: 26%;
  background: var(--blob-4);
  animation: drift-d 26s ease-in-out infinite alternate;
}

/* ========== 03. 页面容器 ========== */
.page {
  position: relative;
  z-index: 1;                    /* 浮于背景层之上 */
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 44px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== 04. 玻璃卡片基础样式 ========== */
/* 核心：backdrop-filter 毛玻璃 + 半透明底 + 内侧高光 + 柔和投影 */
.glass-card {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--glass-inner);
  transition:
    translate 0.45s var(--ease),      /* hover 上浮用 translate 属性，避免与入场动画的 transform 冲突 */
    box-shadow 0.45s var(--ease),
    background-color var(--dur-theme) ease,
    border-color var(--dur-theme) ease;
}

/* hover 轻反馈：上浮 4px + 阴影加深 */
.glass-card:hover {
  translate: 0 -4px;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-inner);
}

/* ========== 05. 顶部标题栏与主题切换按钮 ========== */
.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.site-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.site-sub {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-2);
  transition: color var(--dur-theme) ease;
}

/* 主题切换：圆形玻璃按钮，双图标交叉淡入淡出 */
.theme-btn {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 var(--glass-inner);
  color: var(--text-1);
  cursor: pointer;
  transition:
    transform 0.4s var(--ease),
    background-color var(--dur-theme) ease,
    border-color var(--dur-theme) ease;
}

.theme-btn:hover  { transform: rotate(18deg) scale(1.06); }
.theme-btn:active { transform: scale(0.94); }

/* 太阳 / 月亮都绝对居中，靠主题切换显隐（旋转 + 缩放的进出场） */
.icon-sun,
.icon-moon {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: opacity 0.45s ease, transform 0.5s var(--ease);
}

html[data-theme="light"] .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.4); }
html[data-theme="dark"]  .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.4); }

/* ========== 06. 状态卡片 ========== */
.status-card {
  position: relative;            /* 供右上角锁定按钮绝对定位 */
  padding: 28px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* —— 头像：渐变圆 + 状态圆点 —— */
.avatar {
  position: relative;
  flex-shrink: 0;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fbc2eb 0%, #a6c1ee 100%);
  box-shadow:
    0 0 0 5px color-mix(in srgb, var(--status) 22%, transparent),  /* 状态色光环 */
    var(--shadow-sm);
  transition: box-shadow 0.6s ease;
}

.avatar-text {
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 8px rgba(120, 90, 160, 0.35);
  user-select: none;
}

/* 状态圆点：右下角小圆 + 呼吸脉冲环 */
.avatar-dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--status);
  border: 3px solid var(--avatar-ring);
  transition: background-color 0.5s ease;
}

/* 脉冲光环：向外扩散渐隐 */
.avatar-dot::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--status);
  animation: pulse-ring 2.4s ease-out infinite;
}

/* —— 状态信息区 —— */
.status-info { min-width: 0; }

.name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-right: 44px;           /* 给右上角锁定按钮让位 */
}

.status-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* 状态徽章：状态色药丸（背景/描边/文字均由 --status 派生） */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 9px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--status);
  background: color-mix(in srgb, var(--status) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--status) 32%, transparent);
  transition:
    color 0.5s ease,
    background-color 0.5s ease,
    border-color 0.5s ease;
}

/* 状态切换时徽章弹跳一下（JS 通过 .pop 类重放） */
.status-badge.pop { animation: badge-pop 0.5s var(--ease); }

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status);
  box-shadow: 0 0 8px var(--status);   /* 小辉光 */
  transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

/* 自定义文案与更新时间 */
.status-msg {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-1);
  overflow-wrap: break-word;
}

.status-time {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-3);
  transition: color var(--dur-theme) ease;
}

/* ========== 07. 管理面板 ========== */
/* 折叠动画：max-height + opacity 双过渡，解锁后平滑展开 */
.admin-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition:
    max-height 0.55s var(--ease),
    opacity 0.4s ease 0.08s,
    margin-top 0.55s var(--ease);
}

body.is-admin .admin-panel {
  max-height: 340px;
  opacity: 1;
  margin-top: 24px;
}

/* 分隔线：居中文字 + 两侧细线 */
.admin-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 5px;
  color: var(--text-3);
  transition: color var(--dur-theme) ease;
}

.admin-divider::before,
.admin-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--glass-border);
  transition: background-color var(--dur-theme) ease;
}

/* 状态选择按钮组 */
.status-picker {
  display: flex;
  gap: 10px;
}

/* 每个按钮通过 data-status 拿到自己的 --dot 状态色 */
.picker-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 0;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition:
    transform 0.3s var(--ease),
    color 0.3s ease,
    background-color 0.3s ease,
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.picker-btn[data-status="online"] { --dot: var(--c-online); }
.picker-btn[data-status="away"]   { --dot: var(--c-away); }
.picker-btn[data-status="busy"]    { --dot: var(--c-busy); }

.picker-btn .pick-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot);
  transition: box-shadow 0.3s ease;
}

.picker-btn:hover { transform: translateY(-2px); }

/* 当前生效的状态按钮：状态色填充高亮 */
.picker-btn.active {
  color: var(--dot);
  font-weight: 600;
  background: color-mix(in srgb, var(--dot) 16%, var(--glass));
  border-color: color-mix(in srgb, var(--dot) 45%, transparent);
  box-shadow: 0 4px 14px color-mix(in srgb, var(--dot) 25%, transparent);
}

.picker-btn.active .pick-dot { box-shadow: 0 0 8px var(--dot); }

/* 文案编辑行 */
.msg-editor {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* 输入框与密码框共用玻璃样式 */
.msg-input,
.pwd-input {
  flex: 1;
  min-width: 0;
  padding: 11px 16px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-1);
  font-size: 14px;
  outline: none;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    background-color var(--dur-theme) ease;
}

/* 聚焦：强调色描边 + 柔和光晕 */
.msg-input:focus,
.pwd-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.msg-input::placeholder,
.pwd-input::placeholder { color: var(--text-3); }

/* 保存按钮：渐变实底 */
.save-btn {
  flex-shrink: 0;
  padding: 0 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, opacity 0.3s ease;
}

.save-btn:hover  { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(10, 132, 255, 0.35); }
.save-btn:active { transform: scale(0.96); }

/* ========== 08. 卡片右上角锁定按钮 ========== */
.lock-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0.75;
  transition:
    background-color 0.3s ease,
    color 0.3s ease,
    opacity 0.3s ease,
    transform 0.3s var(--ease);
}

.lock-btn:hover {
  background: var(--glass);
  color: var(--text-1);
  opacity: 1;
  transform: scale(1.08);
}

/* 管理模式下：锁定图标换成解锁图标，并点亮强调色 */
.lock-btn .icon-unlock { display: none; }
body.is-admin .lock-btn .icon-lock   { display: none; }
body.is-admin .lock-btn .icon-unlock { display: block; }
body.is-admin .lock-btn { color: var(--accent); opacity: 1; }

/* ========== 09. 访问统计卡片 ========== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  border-radius: 24px;
}

.stat-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
}

/* PV 蓝色调 / UV 绿色调，图标底用 14% 透明度的同色系 */
.stat-icon-pv {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

.stat-icon-uv {
  color: var(--c-online);
  background: color-mix(in srgb, var(--c-online) 14%, transparent);
}

.stat-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* 数字用等宽数字字形，滚动动画时不抖动 */
.stat-num {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-label {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-2);
  transition: color var(--dur-theme) ease;
}

/* ========== 10. 页脚 ========== */
.site-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  transition: color var(--dur-theme) ease;
}

/* ========== 11. 管理密码弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.32);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;           /* 隐藏时不可交互 */
  transition: opacity 0.35s ease;
}

.modal-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: min(360px, 100%);
  padding: 26px;
  border-radius: 24px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(28px) saturate(170%);
  backdrop-filter: blur(28px) saturate(170%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-inner);
  transform: translateY(18px) scale(0.95);
  transition: transform 0.4s var(--ease);
}

.modal-mask.show .modal { transform: none; }

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-desc {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}

.pwd-input { width: 100%; margin-top: 18px; }

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

.btn {
  padding: 10px 20px;
  border-radius: 14px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, background-color 0.3s ease;
}

.btn-ghost {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-1);
}

.btn-ghost:hover { transform: translateY(-1px); }

.btn-primary {
  border: none;
  background: linear-gradient(135deg, #0a84ff, #5e5ce6);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover  { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(10, 132, 255, 0.35); }
.btn-primary:active { transform: scale(0.96); }

/* ========== 12. Toast 轻提示 ========== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  z-index: 100;
  padding: 11px 24px;
  border-radius: 999px;
  background: rgba(28, 28, 38, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}

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

/* ========== 13. 入场动画 ========== */
/* 页面加载时自上而下依次浮现；anim-1 ~ anim-5 为延迟梯度 */
.anim {
  opacity: 0;
  animation: rise 0.85s var(--ease) forwards;
}

.anim-1 { animation-delay: 0.05s; }
.anim-2 { animation-delay: 0.16s; }
.anim-3 { animation-delay: 0.28s; }
.anim-4 { animation-delay: 0.38s; }
.anim-5 { animation-delay: 0.50s; }

/* ========== 14. 关键帧定义 ========== */

/* 入场：上移淡入 */
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

/* 状态圆点脉冲：向外扩散渐隐 */
@keyframes pulse-ring {
  0%   { transform: scale(0.55); opacity: 0.9; }
  80%  { transform: scale(1.8);  opacity: 0; }
  100% { transform: scale(1.8);  opacity: 0; }
}

/* 徽章弹跳：状态切换时的可爱反馈 */
@keyframes badge-pop {
  0%   { transform: scale(0.75); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* 四个光斑的漂移轨迹（alternate 往返） */
@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vmax, 4vmax) scale(1.12); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-5vmax, -6vmax) scale(1.15); }
}

@keyframes drift-c {
  from { transform: translate(0, 0) scale(1.05); }
  to   { transform: translate(4vmax, -5vmax) scale(0.95); }
}

@keyframes drift-d {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-6vmax, 3vmax) scale(1.1); }
}

/* ========== 15. 响应式适配 ========== */
/* 平板 / 大屏手机 */
@media (max-width: 600px) {
  .page { padding: 32px 18px 40px; }

  .site-title { font-size: 26px; }
  .site-sub   { font-size: 12.5px; }

  .site-header { margin-bottom: 20px; }
  .theme-btn   { width: 42px; height: 42px; }

  .status-card { padding: 22px 20px; border-radius: 24px; }

  .avatar { width: 64px; height: 64px; }
  .avatar-text { font-size: 29px; }
  .avatar-dot { width: 16px; height: 16px; }

  .status-name { font-size: 19px; }
  .status-msg  { font-size: 14px; }

  .stats-grid { gap: 12px; margin-top: 14px; }
  .stat-card  { padding: 18px 16px; gap: 12px; border-radius: 22px; }
  .stat-icon  { width: 42px; height: 42px; border-radius: 13px; }
  .stat-num   { font-size: 24px; }

  .modal { padding: 22px; }
}

/* 小屏手机 */
@media (max-width: 380px) {
  .page { padding: 26px 14px 36px; }

  .picker-btn { font-size: 13px; padding: 9px 0; }

  /* 文案编辑行换行：输入框占满，保存按钮等宽 */
  .msg-editor { flex-wrap: wrap; }
  .msg-input  { flex-basis: 100%; }
  .save-btn   { flex: 1; padding: 11px 0; }
}

/* ========== 16. 无障碍：尊重系统"减弱动态效果" ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .anim { opacity: 1; }        /* 入场动画直接呈现 */
  .blob { animation: none; }   /* 光斑停止漂移 */
}
