*, *::before, *::after { box-sizing: border-box; }

:root {
  --accent: #4da3ff;
  --accent-glow: rgba(77, 163, 255, .45);
  --panel: #141b24;
  --panel-2: #1b242f;
  --line: rgba(255, 255, 255, .09);
  --text: #eaf1f8;
  --dim: #8b98a8;
}

[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05080c; color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC",
               system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.desktop { position: fixed; inset: 0; display: flex; flex-direction: column; }

.wallpaper {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  background-size: cover; background-position: center;
  transition: background-image .45s ease, background .45s ease;
}

.wallpaper-mask {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg,
    rgba(0,0,0,.62) 0%, rgba(0,0,0,.18) 22%, rgba(0,0,0,.10) 50%,
    rgba(0,0,0,.42) 78%, rgba(0,0,0,.72) 100%);
}

.statusbar {
  position: relative; z-index: 5;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1.3rem 2.4rem .6rem;
}

.clock { display: flex; align-items: baseline; gap: .9rem; }

#clockTime {
  font-size: clamp(1.8rem, 2.6vw, 3rem);
  font-weight: 300; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 16px rgba(0,0,0,.6);
}

.clock-date {
  font-size: clamp(.85rem, 1vw, 1.05rem);
  color: rgba(255,255,255,.78);
  text-shadow: 0 2px 12px rgba(0,0,0,.6);
}

.status-right { display: flex; align-items: center; gap: .8rem; }

.weather-box {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.15rem;
  border-radius: 999px;
  border: 2px solid transparent;
  background: rgba(255,255,255,.11);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: all .18s ease;
}

.weather-icon { font-size: 1.8rem; line-height: 1; }
.weather-text { display: flex; flex-direction: column; align-items: flex-start; }
.weather-temp {
  font-size: 1.25rem; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.weather-city {
  font-size: .78rem; color: rgba(255,255,255,.72);
  white-space: nowrap; max-width: 10em;
  overflow: hidden; text-overflow: ellipsis;
}

.icon-btn {
  display: grid; place-items: center;
  width: 2.9rem; height: 2.9rem;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255,255,255,.11);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 1.25rem;
  transition: all .18s ease;
}

.focusable:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,.20);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 10px 34px rgba(0,0,0,.45);
  transform: scale(1.05);
}

.stage {
  position: relative; z-index: 5;
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center;
  padding: 0 3rem;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.4rem 1.6rem;
  width: 100%; max-height: 100%;
  padding: .5rem 0; overflow: hidden;
}

.app {
  display: flex; flex-direction: column; align-items: center;
  gap: .7rem;
  padding: 1.1rem .5rem 1rem;
  border-radius: 20px;
  border: 2px solid transparent;
  background: transparent;
  transition: transform .18s cubic-bezier(.34,1.4,.5,1),
              background .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.app:focus {
  outline: none;
  transform: scale(1.13);
  background: rgba(255,255,255,.14);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow), 0 16px 44px rgba(0,0,0,.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.app-icon {
  display: grid; place-items: center;
  width: clamp(3.8rem, 5.4vw, 5.6rem);
  height: clamp(3.8rem, 5.4vw, 5.6rem);
  border-radius: 24%;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 8px 24px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.2);
  font-size: clamp(2rem, 2.9vw, 3rem);
  line-height: 1; overflow: hidden;
}

.app-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }

.app-name {
  max-width: 100%;
  font-size: clamp(.82rem, .95vw, 1rem);
  font-weight: 500; text-align: center; line-height: 1.3;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.app-ver { font-size: .72rem; color: rgba(255,255,255,.62); font-variant-numeric: tabular-nums; }

.empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .6rem; color: var(--dim);
}
.empty-icon { font-size: 4rem; opacity: .55; }
.empty-sub { font-size: .85rem; opacity: .7; margin: 0; }

.pagebar {
  position: relative; z-index: 5;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  gap: 1.4rem;
  padding: 1rem 2rem 1.9rem;
}

.page-btn {
  display: grid; place-items: center;
  width: 2.7rem; height: 2.7rem;
  border-radius: 50%;
  border: 2px solid transparent;
  background: rgba(255,255,255,.11);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: .95rem;
  transition: all .18s ease;
}
.page-btn:disabled { opacity: .25; cursor: default; }
.page-btn:disabled:focus { transform: none; box-shadow: none; border-color: transparent; }

.dots { display: flex; align-items: center; gap: .55rem; }
.dot {
  width: .58rem; height: .58rem; border-radius: 50%;
  background: rgba(255,255,255,.32);
  transition: all .22s ease;
}
.dot.active {
  width: 1.7rem; border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 14px rgba(255,255,255,.5);
}

.overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; padding: 2.5rem;
  overflow: auto;
  background: rgba(4, 8, 14, .84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeIn .18s ease;
}
.overlay > * { margin: auto; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.panel {
  width: min(960px, 100%);
  max-height: calc(100vh - 5rem);
  display: flex; flex-direction: column;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 30px 90px rgba(0,0,0,.65);
  overflow: hidden;
  animation: popIn .2s cubic-bezier(.34,1.3,.55,1);
}
.panel-sm { width: min(640px, 100%); }

@keyframes popIn {
  from { opacity: 0; transform: scale(.95) translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1r