/* Cirrus 首页样式：全屏壁纸 + 毛玻璃卡片 + 底部 Dock */

:root {
  --wp-mask: .3;
  --wp-blur: 0px;
  --card-blur: 16px;
  --card-opacity: .55;
  --card-radius: 18px;
  --card-rgb: 255, 255, 255;
  --card-text: #161b26;
  --card-sub: #5a6474;
  --glass-rgb: 255, 255, 255;
  --glass-opacity: .5;
  --glass-text: #161b26;
  --border-rgb: 255, 255, 255;
  --border-opacity: .5;
  --accent: #2f6bff;
  --shadow: 0 10px 30px rgba(8, 14, 30, .18);
  color-scheme: light;
}

[data-theme="dark"] {
  --card-rgb: 20, 23, 31;
  --card-text: #eef1f7;
  --card-sub: #a3acbd;
  --glass-rgb: 16, 19, 26;
  --glass-opacity: .5;
  --glass-text: #eef1f7;
  --border-rgb: 255, 255, 255;
  --border-opacity: .14;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #fff;
  background: #22304a;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ------------------------------ 背景 ------------------------------ */

.wallpaper {
  position: fixed;
  inset: -2%;
  z-index: -2;
  background-image: linear-gradient(135deg, #2b3f6b 0%, #5b4a8f 45%, #a4567f 100%);
  background-size: cover;
  background-position: center;
  filter: blur(var(--wp-blur));
  transition: opacity .6s ease, background-image .4s ease;
}

.wallpaper-mask {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(6, 10, 20, var(--wp-mask));
  pointer-events: none;
}

/* ------------------------------ 顶栏 ------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px clamp(16px, 4vw, 40px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  min-width: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 20px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .25);
  backdrop-filter: blur(10px);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; text-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.brand-text b { font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(var(--glass-rgb), calc(var(--glass-opacity) * .8));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(12px);
  color: var(--glass-text);
}
.clock b { font-size: 15px; font-variant-numeric: tabular-nums; }
.clock small { font-size: 11px; opacity: .75; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  color: var(--glass-text);
  background: rgba(var(--glass-rgb), var(--glass-opacity));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(12px);
  transition: transform .18s ease, background .18s ease;
}
.icon-btn:hover { transform: translateY(-2px); background: rgba(var(--glass-rgb), calc(var(--glass-opacity) + .15)); }

/* ------------------------------ 主体 ------------------------------ */

.stage {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: clamp(12px, 4vh, 46px) clamp(14px, 4vw, 32px) 150px;
}

.search { position: relative; width: min(680px, 100%); margin: 0 auto clamp(20px, 4vh, 40px); }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 18px;
  border-radius: 999px;
  background: rgba(var(--glass-rgb), var(--glass-opacity));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow);
  transition: box-shadow .2s ease, transform .2s ease;
}
.search-box:focus-within { box-shadow: 0 0 0 3px rgba(47, 107, 255, .35), var(--shadow); }

.search-icon { font-size: 15px; opacity: .7; }

#searchInput {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--glass-text);
}
#searchInput::placeholder { color: var(--glass-text); opacity: .55; }
#searchInput::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

.engine-select {
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  background: rgba(var(--glass-rgb), calc(var(--glass-opacity) + .1));
  color: var(--glass-text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.engine-select option { color: #111; background: #fff; }

.search-kbd {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border-radius: 7px;
  font-size: 12px;
  font-family: inherit;
  color: var(--glass-text);
  opacity: .6;
  border: 1px solid rgba(var(--border-rgb), calc(var(--border-opacity) + .1));
}

.suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  border-radius: 18px;
  background: rgba(var(--glass-rgb), calc(var(--glass-opacity) + .28));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.suggest li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--glass-text);
}
.suggest li.active, .suggest li:hover { background: rgba(var(--glass-rgb), .25); }
.suggest li .s-thumb { width: 20px; height: 20px; border-radius: 6px; flex: none; object-fit: contain; }
.suggest li .s-title { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest li .s-host { font-size: 12px; opacity: .6; }

.banner {
  width: min(680px, 100%);
  margin: 0 auto 22px;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: #ffe7c2;
  background: rgba(180, 90, 20, .35);
  border: 1px solid rgba(255, 190, 120, .35);
  backdrop-filter: blur(10px);
  word-break: break-all;
}

.board-section { margin-bottom: 30px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .45);
}
.section-title .section-icon { font-size: 16px; }
.section-title em { font-style: normal; font-size: 12px; opacity: .55; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 12px 14px;
  border-radius: var(--card-radius);
  background: rgba(var(--card-rgb), var(--card-opacity));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(var(--card-blur));
  box-shadow: var(--shadow);
  color: var(--card-text);
  text-decoration: none;
  text-align: center;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(8, 14, 30, .28); }

.card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(var(--card-rgb), .5);
  overflow: hidden;
}
.card-icon img { width: 30px; height: 30px; object-fit: contain; }
.card-letter {
  display: none;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.card-icon.letter-mode .card-letter { display: block; }

.card-title {
  font-size: 14px;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-desc {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--card-sub);
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.35em;
}

.empty {
  padding: 60px 20px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.empty a { color: #cfe0ff; }

.footer {
  margin: 30px 0 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, .75);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}

/* ------------------------------ Dock ------------------------------ */

.dock {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(94vw, 1000px);
  padding: 8px;
  border-radius: 22px;
  background: rgba(var(--glass-rgb), calc(var(--glass-opacity) + .18));
  border: 1px solid rgba(var(--border-rgb), var(--border-opacity));
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  overflow-x: auto;
  scrollbar-width: none;
}
.dock::-webkit-scrollbar { display: none; }

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 62px;
  padding: 7px 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--glass-text);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.dock-btn:hover { background: rgba(var(--glass-rgb), .22); }
.dock-btn.active { background: rgba(var(--glass-rgb), .34); box-shadow: inset 0 0 0 1px rgba(var(--border-rgb), .3); }
.dock-icon { font-size: 18px; line-height: 1; }
.dock-icon img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }
.dock-name { max-width: 74px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

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

@media (max-width: 720px) {
  .brand-text small { display: none; }
  .clock { display: none !important; }
  .search-kbd { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .card { padding: 12px 8px 10px; }
  .card-icon { width: 40px; height: 40px; }
  .card-icon img { width: 26px; height: 26px; }
  .card-desc { display: none; }
  .stage { padding-bottom: 130px; }
  .dock-btn { min-width: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
