:root {
  --bg: #fbf9f5;
  --bg2: #f3efe8;
  --ink: #1b1a18;
  --ink2: #6f6a63;
  --ink3: #a8a29a;
  --card: #ffffff;
  --blue: #12b7f5;
  --line: rgba(0,0,0,.07);
  --safe: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}

/* ── 锁屏 ── */
#lock {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(180deg, #fbf9f5 0%, #f3efe8 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  touch-action: none;
  transition: opacity .3s var(--ease);
}
#lock.gone { display: none; }
.lk-wrap { display: flex; flex-direction: column; align-items: center; will-change: transform, opacity; }
.lk-time {
  font-size: clamp(64px, 18vw, 92px);
  font-weight: 250; letter-spacing: -2.5px; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lk-date { margin-top: 12px; font-size: 13.5px; color: var(--ink2); letter-spacing: .6px; }
.lk-name { margin-top: 36px; font-size: 15px; letter-spacing: 7px; color: var(--ink3); }

.lk-hint {
  position: absolute; bottom: calc(48px + var(--safe)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--ink2); font-size: 13px; letter-spacing: 2.5px;
  transition: opacity .25s var(--ease);
}
.lk-chev { display: flex; flex-direction: column; align-items: center; }
.lk-chev i {
  display: block; width: 13px; height: 13px;
  border-left: 2px solid var(--ink2); border-top: 2px solid var(--ink2);
  transform: rotate(45deg); margin-top: -5px;
  animation: bob 1.5s ease-in-out infinite;
  border-radius: 2px 0 0 0;
}
.lk-chev i:nth-child(2) { opacity: .5; animation-delay: .16s; }
.lk-chev i:nth-child(3) { opacity: .25; animation-delay: .32s; }
@keyframes bob {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50% { transform: rotate(45deg) translate(2px, -2px); }
}
.lk-bar {
  position: absolute; bottom: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, #4fc9ff, var(--blue));
  box-shadow: 0 0 12px rgba(18,183,245,.55);
  transition: width .08s linear;
}

/* ── 主屏 ── */
#home {
  height: 100%;
  padding: calc(30px + env(safe-area-inset-top, 0px)) 22px calc(20px + var(--safe));
  display: flex; flex-direction: column;
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .4s var(--ease), transform .45s var(--ease);
  overflow-y: auto;
}
#home.on { opacity: 1; transform: none; }

.head { text-align: center; padding-top: 14px; }
.clock {
  font-size: clamp(58px, 16vw, 82px);
  font-weight: 250; letter-spacing: -2px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.date { margin-top: 10px; font-size: 13px; color: var(--ink2); letter-spacing: .5px; }

/* 图标网格 */
.grid {
  flex: 1;
  margin-top: 38px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 26px 12px;
  align-content: start;
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-decoration: none; color: inherit; background: none; border: 0; padding: 0;
  cursor: pointer;
  transition: transform .16s var(--ease);
}
.tile:active { transform: scale(.9); }

.ic {
  width: 58px; height: 58px; border-radius: 18px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(0,0,0,.055), 0 0 0 1px var(--line);
  display: flex; align-items: center; justify-content: center;
  color: #3d3a35;
  transition: box-shadow .2s var(--ease), transform .16s var(--ease);
}
.ic svg { width: 28px; height: 28px; }
.ic img { width: 34px; height: 34px; object-fit: contain; filter: none; }
.tile:active .ic { box-shadow: 0 1px 5px rgba(0,0,0,.07), 0 0 0 1px var(--line); }

.lb { font-size: 12px; color: var(--ink2); letter-spacing: .3px; }

/* QQ 图标特殊一点：微微描边 */
.tile[data-key="qq"] .ic { background: #fff; }

/* 底部 */
.foot {
  padding-top: 18px; text-align: center;
  font-size: 11px; color: var(--ink3); letter-spacing: .4px;
}

/* ── 弹层 ── */
#sheet {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.35);
  display: none; align-items: flex-end;
  backdrop-filter: blur(3px);
}
#sheet.on { display: flex; animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-inner {
  width: 100%; background: #fff; border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + var(--safe));
  animation: up .26s var(--ease);
}
@keyframes up { from { transform: translateY(16px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-inner h3 { margin: 0 0 12px; font-size: 17px; }
.sheet-inner p { margin: 0 0 8px; font-size: 14px; color: var(--ink); line-height: 1.6; }
.sheet-inner .muted { color: var(--ink3); font-size: 12.5px; }
.sheet-inner button {
  width: 100%; height: 44px; margin-top: 14px;
  border: 0; border-radius: 12px; background: var(--bg2);
  color: var(--ink); font-size: 15px;
  transition: transform .12s var(--ease);
}
.sheet-inner button:active { transform: scale(.97); }

/* 桌面宽屏稍微收一下 */
@media (min-width: 520px) {
  #home { max-width: 520px; margin: 0 auto; }
  .grid { grid-template-columns: repeat(4, 1fr); }
}
