/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: #f4f5f7;
  color: #161718;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
  font-family: "Bodoni 72", Didot, "Bodoni MT", "Playfair Display", Georgia, serif;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== 暗→亮 入场过渡 ===== */
.screen {
  position: fixed;
  inset: 0;
  background: #f4f5f7;
  z-index: 0;
  opacity: 0;
  animation: lightUp 1.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards;
}

@keyframes lightUp {
  0% { opacity: 0; background: #0a0a0b; }
  35% { opacity: 0.6; background: #1e2024; }
  70% { opacity: 0.9; background: #8e9098; }
  100% { opacity: 1; background: #f4f5f7; }
}

/* ===== 光晕扩散（冷调） ===== */
.glow {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 100vmax;
  height: 100vmax;
  transform: translate(-50%, -50%) scale(0.3);
  background: radial-gradient(circle at 50% 60%, #c8c9cb 0%, #c8c9cb 18%, transparent 50%);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  animation: glowExpand 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

@keyframes glowExpand {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
  40% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.8); }
  100% { opacity: 0.12; transform: translate(-50%, -50%) scale(2.2); }
}

/* ===== 主内容 ===== */
.lockscreen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(env(safe-area-inset-top, 0px) + 8vh)
    32px
    calc(env(safe-area-inset-bottom, 0px) + 5vh);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  animation: contentIn 1.0s ease 1.0s forwards;
}

@keyframes contentIn {
  to { opacity: 1; }
}

/* ===== 顶部：时间 & 日期 ===== */
.top {
  padding-top: 2vh;
}

.time {
  font-size: clamp(64px, 16vw, 110px);
  font-weight: 200;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #161718;
  font-family: "Bodoni 72", Didot, "Bodoni MT", "Playfair Display", Georgia, serif;
}

.time .ampm {
  font-size: clamp(14px, 2.4vw, 22px);
  font-weight: 300;
  letter-spacing: 0.2em;
  margin-left: 6px;
  color: #888b91;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.date {
  margin-top: 6px;
  font-size: clamp(13px, 1.8vw, 18px);
  font-weight: 300;
  letter-spacing: 0.35em;
  color: #888b91;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  text-transform: uppercase;
}

.sub {
  margin-top: 4px;
  font-size: clamp(10px, 1.2vw, 13px);
  font-weight: 300;
  letter-spacing: 0.5em;
  color: #b0b2b7;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  text-transform: uppercase;
}

/* ===== 中间留白 ===== */
.spacer {
  flex: 1;
}

/* ===== 底部：滑动解锁 ===== */
.bottom {
  padding-bottom: 2vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.unlock-track {
  position: relative;
  width: min(86%, 340px);
  height: 54px;
  border-radius: 40px;
  border: 1px solid rgba(22, 23, 24, 0.08);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
  overflow: hidden;
  touch-action: none;
}

.unlock-track .hint {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.5em;
  color: rgba(22, 23, 24, 0.2);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

.unlock-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  bottom: 4px;
  width: 52px;
  border-radius: 40px;
  background: linear-gradient(135deg, #2d2e30 0%, #55575c 100%);
  box-shadow: 0 2px 12px rgba(22, 23, 24, 0.15), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: grab;
  touch-action: none;
  transition: box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.unlock-thumb:active {
  cursor: grabbing;
  box-shadow: 0 4px 20px rgba(22, 23, 24, 0.25);
}

.unlock-thumb svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #c8c9cb;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.unlock-thumb .arrow-line {
  stroke: #c8c9cb;
}

/* ===== 滑动解锁成功状态 ===== */
.unlock-track.is-unlocked .unlock-thumb {
  left: calc(100% - 56px);
  transition: left 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: default;
}

.unlock-track.is-unlocked .hint {
  opacity: 0;
  transition: opacity 0.3s;
}

/* ===== 适配小屏 ===== */
@media (max-width: 380px) {
  .time { font-size: 52px; }
  .lockscreen { padding-left: 20px; padding-right: 20px; }
  .unlock-track { height: 48px; }
  .unlock-thumb { width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .glow, .lockscreen { animation: none !important; }
  .screen { opacity: 1; background: #f4f5f7; }
  .glow { opacity: 0.10; transform: translate(-50%, -50%) scale(1.8); }
  .lockscreen { opacity: 1; }
}

/* ============================================================
   HOME 主屏幕样式
   ============================================================ */

/* ===== 主屏容器 ===== */
.homescreen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 20px env(safe-area-inset-bottom, 0px);
  display: flex;
  flex-direction: column;
  background: #f4f5f7;
}

/* ===== 状态栏 ===== */
.homescreen .status-bar {
  padding-top: calc(env(safe-area-inset-top, 0px) + 6px);
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: #161718;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
.homescreen .status-bar .status-icons {
  display: flex;
  gap: 4px;
  font-weight: 400;
  color: rgba(22, 23, 24, 0.35);
  font-size: 11px;
}

/* ===== 主屏幕网格（4列 × 7行） ===== */
.homescreen .grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 12px 8px;
  padding: 6px 0 4px;
  align-content: center;
}

/* ===== App 图标 ===== */
.homescreen .app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.homescreen .app:active {
  transform: scale(0.88);
}

.homescreen .app .icon {
  width: clamp(48px, 8.4vw, 60px);
  height: clamp(48px, 8.4vw, 60px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(22, 23, 24, 0.04);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.01);
}

.homescreen .app .icon svg {
  width: clamp(22px, 4vw, 32px);
  height: clamp(22px, 4vw, 32px);
  stroke: #161718;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.homescreen .app .label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(22, 23, 24, 0.65);
  text-align: center;
  line-height: 1.2;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

/* 三个软件配色 — 极低饱和度 */
.homescreen .app.settings .icon { background: rgba(220, 220, 225, 0.35); }
.homescreen .app.wechat .icon { background: rgba(195, 215, 225, 0.30); }
.homescreen .app.editor .icon { background: rgba(215, 205, 190, 0.30); }

/* ===== 空白格 ===== */
.homescreen .app.empty {
  cursor: default;
  pointer-events: all;
}
.homescreen .app.empty .icon,
.homescreen .app.empty .label {
  display: none;
}

/* ===== Dock ===== */
.homescreen .dock {
  padding: 10px 0 4px;
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 2px);
  border-top: 1px solid rgba(22, 23, 24, 0.04);
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.homescreen .dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  padding: 4px 0;
  flex: 1;
  transition: transform 0.12s;
}
.homescreen .dock-item:active {
  transform: scale(0.88);
}
.homescreen .dock-item .icon {
  width: clamp(40px, 6.4vw, 50px);
  height: clamp(40px, 6.4vw, 50px);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(22, 23, 24, 0.03);
  font-size: clamp(16px, 2.6vw, 22px);
  color: rgba(22, 23, 24, 0.15);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
.homescreen .dock-item .label {
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: rgba(22, 23, 24, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}
.homescreen .dock-item.placeholder .icon {
  background: transparent;
  border: 1px dashed rgba(22, 23, 24, 0.04);
}
.homescreen .dock-item.placeholder .label {
  color: rgba(22, 23, 24, 0.10);
}

/* ===== 品牌足标 ===== */
.homescreen .brand-foot {
  text-align: center;
  padding: 2px 0 4px;
  font-size: 8px;
  letter-spacing: 0.5em;
  color: rgba(22, 23, 24, 0.08);
  text-transform: uppercase;
  font-weight: 300;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

/* ===== 响应式 ===== */
@media (max-width: 380px) {
  .homescreen { padding: 0 12px env(safe-area-inset-bottom, 0px); }
  .homescreen .grid { gap: 8px 4px; }
  .homescreen .app .icon {
    width: clamp(40px, 7vw, 48px);
    height: clamp(40px, 7vw, 48px);
    border-radius: 12px;
  }
  .homescreen .app .icon svg {
    width: 18px;
    height: 18px;
  }
  .homescreen .app .label { font-size: 9px; }
}

@media (min-width: 600px) {
  .homescreen .grid { gap: 16px 12px; }
}

/* ============================================================
   拖拽排序样式 — 长按触发（Android 风格）
   ============================================================ */

/* 拖拽中的克隆体 — 纯净白色圆 + 阴影（Android 原生风格） */
.dragging-clone {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  width: clamp(56px, 9.6vw, 72px) !important;
  height: clamp(56px, 9.6vw, 72px) !important;
  border-radius: 50% !important;
  background: #ffffff !important;
  box-shadow: 
    0 2px 8px rgba(22, 23, 24, 0.06),
    0 8px 24px rgba(22, 23, 24, 0.10),
    0 16px 48px rgba(22, 23, 24, 0.08),
    0 0 0 0.5px rgba(22, 23, 24, 0.02);
  transform: scale(1.06);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: none !important;
  cursor: grabbing;
  will-change: transform;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* 克隆体内的图标 — 只显示 SVG，不显示背景框和文字 */
.dragging-clone .icon {
  width: clamp(28px, 4.8vw, 36px) !important;
  height: clamp(28px, 4.8vw, 36px) !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.dragging-clone .icon svg {
  width: clamp(22px, 4vw, 32px) !important;
  height: clamp(22px, 4vw, 32px) !important;
  stroke: #161718;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 克隆体内隐藏文字和多余元素 */
.dragging-clone .label,
.dragging-clone .app .label {
  display: none !important;
}

/* 被拖拽元素原位置隐藏（优雅淡出） */
.homescreen .app.is-dragging {
  opacity: 0 !important;
  transform: scale(0.85);
  transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1), 
              transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 所有网格长按后显示边框（极细描边） */
.homescreen .app.grid-highlight {
  outline: 0.5px solid rgba(22, 23, 24, 0.06);
  outline-offset: -0.5px;
  border-radius: 16px;
  transition: outline 0.2s ease;
}

/* 目标高亮（拖拽悬停时）— 克制的反馈 */
.homescreen .app.drop-target {
  outline: 1.5px solid rgba(22, 23, 24, 0.22);
  outline-offset: -1.5px;
  border-radius: 16px;
  background: rgba(22, 23, 24, 0.018);
  transition: outline 0.18s cubic-bezier(0.22, 1, 0.36, 1), 
              background 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

/* 空位边框样式（虚线，更细） */
.homescreen .app.empty.grid-highlight {
  outline: 0.5px dashed rgba(22, 23, 24, 0.05);
  outline-offset: -0.5px;
  border-radius: 16px;
  background: transparent;
}

/* 空位目标高亮 */
.homescreen .app.empty.drop-target {
  outline: 1.5px dashed rgba(22, 23, 24, 0.18);
  outline-offset: -1.5px;
  border-radius: 16px;
  background: rgba(22, 23, 24, 0.012);
}

/* 拖拽时禁用默认交互效果 */
.homescreen .grid.is-dragging .app:active {
  transform: none;
}

.homescreen .grid.is-dragging .app {
  cursor: default;
}