/* ========== 9G Hub 桌面 ========== */

:root {
  --text: #fff;
  --text-dim: rgba(255, 255, 255, .72);
  --accent: #38bdf8;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  user-select: none;
  background: #1e293b;
}

/* ---------- 壁纸层 ---------- */

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: #1e293b center center / cover no-repeat;
  transition: background-image .4s ease;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .38));
  pointer-events: none;
}

/* ---------- 左侧 Dock ---------- */

.dock {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0 20px;
  gap: 14px;
  z-index: 30;
}

.dock-logo {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .08);
  margin-bottom: 8px;
}

.dock-logo img { width: 100%; height: 100%; display: block; }

.dock-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  align-items: center;
  overflow-y: auto;
  scrollbar-width: none;
}

.dock-nav::-webkit-scrollbar { display: none; }

.dock-item {
  width: 60px;
  padding: 8px 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  border-radius: 14px;
  color: rgba(255, 255, 255, .68);
  font-size: 10.5px;
  cursor: pointer;
  transition: background .18s, color .18s;
  font-family: inherit;
}

.dock-item svg { width: 21px; height: 21px; }

.dock-item:hover {
  color: #fff;
  background: rgba(255, 255, 255, .12);
}

.dock-item.active {
  color: #fff;
  background: rgba(255, 255, 255, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

.dock-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dock-icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .75);
  cursor: pointer;
  transition: background .18s, color .18s;
}

.dock-icon-btn svg { width: 18px; height: 18px; }
.dock-icon-btn:hover { background: rgba(255, 255, 255, .2); color: #fff; }

/* ---------- 桌面主区 ---------- */

.desktop {
  height: 100vh;
  margin-left: 76px;
  padding: 34px 28px 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: none;
}

.desktop::-webkit-scrollbar { display: none; }

.clock-block { text-align: center; margin-bottom: 18px; }

.clock {
  font-size: clamp(56px, 7vw, 84px);
  font-weight: 250;
  letter-spacing: .02em;
  line-height: 1.05;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .28);
  font-variant-numeric: tabular-nums;
}

.date-line {
  margin-top: 4px;
  font-size: 14px;
  color: rgba(255, 255, 255, .88);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

/* ---------- 搜索胶囊 ---------- */

.search-pill {
  width: min(620px, 88%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 9px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .26);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  margin-bottom: 28px;
  position: relative;
  z-index: 20;
}

/* 搜索引擎选择器 */
.engine-picker { position: relative; }

.engine-trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 5px;
  background: transparent;
  border: none;
  border-radius: 9px;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  transition: background .15s;
}

.engine-trigger:hover { background: rgba(255, 255, 255, .14); }

.engine-trigger img {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: block;
}

.engine-trigger .chev {
  width: 12px;
  height: 12px;
  transition: transform .18s ease;
}

.engine-picker.open .chev { transform: rotate(180deg); }

.engine-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: -8px;
  display: flex;
  gap: 2px;
  padding: 8px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .28), 0 2px 8px rgba(0, 0, 0, .08);
  transform-origin: top left;
  animation: engineIn .16s ease;
  z-index: 40;
}

.engine-menu.hidden { display: none; }

@keyframes engineIn {
  from { opacity: 0; transform: translateY(-5px) scale(.95); }
  to   { opacity: 1; transform: none; }
}

.engine-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 62px;
  padding: 8px 4px 6px;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  color: #334155;
  transition: background .15s;
}

.engine-option:hover { background: rgba(0, 0, 0, .06); }

.engine-option.active {
  background: rgba(56, 189, 248, .16);
  color: #075985;
  font-weight: 600;
}

.engine-option img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

.search-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, .25);
}

.search-pill input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  font-family: inherit;
}

.search-pill input::placeholder { color: rgba(255, 255, 255, .62); }

.search-go {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  transition: background .18s;
}

.search-go svg { width: 16px; height: 16px; }
.search-go:hover { background: rgba(255, 255, 255, .28); }

/* ---------- 站点图标网格 ---------- */

.dash-grid {
  width: 100%;
  max-width: 1280px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 16px 6px;
  padding-bottom: 8px;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 10px 4px 8px;
  text-decoration: none;
  color: #fff;
  border-radius: 16px;
  transition: background .18s;
}

.app-card:hover { background: rgba(255, 255, 255, .1); }

.app-icon {
  width: min(64px, 100%);
  aspect-ratio: 1;
  border-radius: 22%;
  display: grid;
  place-items: center;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .28);
  transition: transform .2s cubic-bezier(.4, 0, .2, 1), box-shadow .2s;
  overflow: hidden;
}

.app-card:hover .app-icon {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 14px 28px rgba(0, 0, 0, .36);
}

.app-card:active .app-icon { transform: scale(.94); }

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 品牌色图标：纯色底 + 白色矢量 logo */
.app-icon.brand img {
  width: 55%;
  height: 55%;
  object-fit: contain;
}

/* 低分辨率位图：不再强行放大铺满，居中缩小显示 */
.app-icon.loose img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.app-icon.game {
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  padding: 6px;
  text-align: center;
  line-height: 1.15;
}

.app-name {
  font-size: 11px;
  line-height: 1.25;
  max-width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 底部引言 ---------- */

.quote {
  margin-top: auto;
  padding: 26px 16px 10px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .55);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}

/* ---------- 弹窗 ---------- */

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-mask.hidden { display: none; }

.modal {
  width: 100%;
  max-width: 360px;
  padding: 22px;
  border-radius: 20px;
  background: rgba(15, 23, 42, .92);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.modal h3 { font-size: 15px; margin-bottom: 16px; }

.modal label {
  display: block;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .64);
  margin-bottom: 12px;
}

.modal input,
.modal select {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}

.modal select option { background: #1e293b; }

.modal input:focus,
.modal select:focus { border-color: var(--accent); }

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

.btn-primary,
.btn-ghost {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary { background: var(--accent); color: #082f49; font-weight: 700; }
.btn-primary:hover { background: #7dd3fc; }

.btn-ghost {
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .8);
}

.btn-ghost:hover { background: rgba(255, 255, 255, .18); }

.hidden { display: none !important; }

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
  .dock { width: 64px; }
  .desktop { margin-left: 64px; padding: 22px 14px 14px; }
  .clock { font-size: 52px; }
  .search-pill { width: 100%; }
  .dash-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 14px 4px;
  }
  .app-icon { width: min(58px, 100%); }
  .app-name { font-size: 10px; }
}

@media (max-width: 400px) {
  .dock { width: 56px; }
  .desktop { margin-left: 56px; padding: 16px 10px 10px; }
  .dock-item { width: 50px; }
}
