/* ====== 基础 ====== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-0: #02030a;
  --bg-1: #06081a;
  --bg-2: #0d1230;
  --fg: #f0f3ff;
  --fg-dim: #8891bd;
  --accent: #8fb8ff;
  --accent-2: #d3a7ff;
  --accent-3: #7ee0ff;
  --glass: rgba(12, 16, 36, 0.55);
  --stroke: rgba(255, 255, 255, 0.08);
}

html, body {
  width: 100%; height: 100%;
  /* 更黑的深空 + 顶部一点点蓝紫光 */
  background:
    radial-gradient(ellipse at 50% -10%, #111a44 0%, transparent 55%),
    radial-gradient(ellipse at 10% 110%, #1b0f3a 0%, transparent 50%),
    radial-gradient(ellipse at 90% 110%, #0e1a3a 0%, transparent 50%),
    #02030a;
  color: var(--fg);
  font-family: "Fredoka", "ZCOOL KuaiLe", -apple-system, BlinkMacSystemFont,
               "SF Pro Rounded", "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ====== 星空 Canvas ====== */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* ====== 卡通装饰 ====== */
.deco-moon {
  position: fixed;
  top: 12vh;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(260px, 34vw, 460px);
  height: clamp(260px, 34vw, 460px);
  z-index: 1;
  pointer-events: none;
  animation: floatMoon 10s ease-in-out infinite;
}
.deco-moon .moon-body {
  width: 100%; height: 100%;
  filter: drop-shadow(0 0 36px rgba(200, 220, 255, 0.35))
          drop-shadow(0 0 80px rgba(130, 160, 255, 0.25));
}
.deco-moon .moon-halo {
  position: absolute; inset: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180,200,255,0.22) 0%, rgba(180,200,255,0.08) 40%, transparent 70%);
  filter: blur(8px);
}

@keyframes floatMoon {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, -14px); }
}

.deco-cloud {
  position: fixed;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 -6px 24px rgba(0, 0, 0, 0.4));
}
.deco-cloud--left {
  bottom: 6vh;
  left: -60px;
  width: clamp(280px, 38vw, 520px);
  animation: cloudDriftL 16s ease-in-out infinite;
}
.deco-cloud--right {
  bottom: 2vh;
  right: -80px;
  width: clamp(260px, 36vw, 500px);
  animation: cloudDriftR 18s ease-in-out infinite;
}
@keyframes cloudDriftL {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(18px); }
}
@keyframes cloudDriftR {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(-22px); }
}

/* ====== 顶部 ====== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 68px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  background: linear-gradient(180deg, rgba(2, 3, 10, 0.7) 0%, rgba(2, 3, 10, 0) 100%);
}

.brand {
  display: flex; align-items: baseline; gap: 10px;
  user-select: none;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, var(--accent) 60%, transparent 100%);
  box-shadow: 0 0 14px var(--accent), 0 0 28px rgba(143, 184, 255, 0.5);
  align-self: center;
  animation: pulseDot 2.4s ease-in-out infinite;
}
@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.25); opacity: 0.85; }
}
.brand .title {
  font-family: "Fredoka", sans-serif;
  font-size: 20px; font-weight: 700; letter-spacing: 0.28em;
  background: linear-gradient(90deg, #fff, var(--accent-3), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .subtitle {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: 14px; color: var(--fg-dim); letter-spacing: 0.16em;
}

.search-wrap {
  flex: 1; max-width: 560px;
  margin: 0 auto;
  position: relative;
  display: flex; align-items: center;
  background: var(--glass);
  border: 1.5px solid var(--stroke);
  border-radius: 999px;
  padding: 0 18px;
  height: 42px;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.search-wrap:focus-within {
  border-color: rgba(143, 184, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(143, 184, 255, 0.12), 0 10px 36px rgba(0,0,0,0.4);
  background: rgba(16, 22, 48, 0.82);
}
.search-wrap .search-icon { color: var(--fg-dim); margin-right: 10px; }
.search-wrap input {
  flex: 1; height: 100%;
  background: transparent;
  border: none; outline: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.search-wrap input::placeholder { color: var(--fg-dim); }
.shortcut, kbd {
  font-family: inherit;
  font-size: 11px;
  color: var(--fg-dim);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 2px 7px;
  background: rgba(255,255,255,0.04);
}

.reset {
  background: transparent;
  color: var(--fg-dim);
  border: 1.5px solid var(--stroke);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
  letter-spacing: 0.08em;
}
.reset:hover { color: var(--fg); border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.06); }

/* ====== 词云 ====== */
.cloud {
  position: fixed;
  inset: 68px 0 40px 0;
  z-index: 10;
  overflow: hidden;
}

.star {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  font-family: "Fredoka", "ZCOOL KuaiLe", sans-serif;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  transition:
    color 0.35s ease,
    text-shadow 0.35s ease,
    background 0.25s ease,
    border-color 0.25s ease,
    filter 0.25s ease,
    transform 0.22s cubic-bezier(.2,.7,.3,1.4),
    opacity 1.1s ease;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  will-change: left, top, opacity;
  opacity: 0;
}
/* 通用可见：根据频次在 JS 里设置 --alpha （0.55–1.0）来控制添加站点的基础亮度 */
.star.ready { opacity: var(--alpha, 0.75); }
/* 轮换隐藏态：彻底淑出不拦点击 */
.star.rotating-hidden { opacity: 0 !important; pointer-events: none; }
/* pinned （高频锚定）态略微高中一点，保证不意外变淡 */
.star.pinned { opacity: var(--alpha, 0.9); }

.star .name {
  color: inherit;
  text-shadow:
    0 0 10px color-mix(in oklab, currentColor 35%, transparent),
    0 0 22px color-mix(in oklab, currentColor 18%, transparent);
}
.star .cat-tag {
  font-size: 0.6em;
  color: var(--fg-dim);
  margin-left: 8px;
  letter-spacing: 0.1em;
  opacity: 0.55;
}
.star:hover {
  color: #fff !important;
  text-shadow: 0 0 14px rgba(255,255,255,0.9), 0 0 28px var(--accent) !important;
  background: rgba(143, 184, 255, 0.12);
  border-color: rgba(143, 184, 255, 0.5);
  z-index: 30;
  transform: translate(-50%, -50%) scale(1.32);
  opacity: 1 !important;
  filter: drop-shadow(0 4px 22px rgba(143,184,255,0.35));
}

/* ====== Hover 气泡 ====== */
.star-tip {
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(18, 22, 38, 0.92);
  border: 1px solid rgba(143, 184, 255, 0.35);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 24px rgba(143,184,255,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f3f6ff;
  font-family: "Fredoka", "ZCOOL KuaiLe", -apple-system, sans-serif;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.star-tip.show { opacity: 1; transform: translateY(0); }
.star-tip-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}
.star-tip-meta {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.02em;
}
.star-tip-cat {
  color: var(--accent-3, #c79bff);
  font-weight: 500;
}
.star-tip-host {
  color: rgba(255,255,255,0.75);
}

/* ====== 拖拽删除：左下角删除星星 ====== */
.trash-star {
  position: fixed;
  left: 32px;
  bottom: 28px;
  z-index: 1100;
  width: 110px;
  height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(40px) scale(0.6) rotate(-25deg);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(.2,.8,.3,1.4);
  filter: drop-shadow(0 6px 18px rgba(255,180,90,0.35));
}
.trash-star.show {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}
.trash-star .trash-svg {
  transition: transform 0.25s cubic-bezier(.2,.7,.3,1.5), filter 0.25s ease;
  animation: trashWobble 2.6s ease-in-out infinite;
}
.trash-star.active .trash-svg {
  transform: scale(1.25) rotate(8deg);
  filter: drop-shadow(0 0 22px rgba(255,210,120,0.95)) drop-shadow(0 0 36px rgba(239,71,111,0.65));
}
.trash-star .trash-tip {
  margin-top: 2px;
  font-size: 12px;
  color: #ffe1b8;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.trash-star.active .trash-tip { opacity: 1; }
@keyframes trashWobble {
  0%, 100% { transform: rotate(-4deg); }
  50%      { transform: rotate(4deg); }
}

/* 拖拽 ghost：跟随鼠标的克隆标签 */
.star-ghost {
  position: fixed;
  left: 0; top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 1300;
  white-space: nowrap;
  font-family: "Fredoka", "ZCOOL KuaiLe", sans-serif;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(143,184,255,0.15);
  border: 1px solid rgba(143,184,255,0.5);
  box-shadow: 0 0 24px rgba(143,184,255,0.45);
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4));
  transition: opacity 0.2s ease;
}
/* 拖拽中原标签变弱 */
.star.drag-source {
  opacity: 0.25 !important;
  filter: blur(0.5px);
}

/* 流星动画：ghost 变成一颗流星飞出屏外 */
.star-ghost.meteor {
  animation: meteorFly 0.85s cubic-bezier(.55,.05,.25,1) forwards;
}
@keyframes meteorFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    filter: drop-shadow(0 0 8px rgba(255,210,120,0.8));
  }
  35% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.15) rotate(-12deg);
    filter: drop-shadow(0 0 22px rgba(255,210,120,1)) drop-shadow(0 0 40px rgba(126,224,255,0.8));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + 520px), calc(-50% - 360px)) scale(0.2) rotate(-45deg);
    filter: drop-shadow(0 0 6px rgba(255,210,120,0.4));
  }
}

/* 搜索匹配态 */
.star.dim { opacity: 0.08 !important; filter: blur(2px); }
.star.hit {
  color: #fff !important;
  text-shadow: 0 0 18px #fff, 0 0 36px var(--accent-3) !important;
  border-color: rgba(126, 224, 255, 0.55);
  background: rgba(126, 224, 255, 0.1);
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* ====== 这个节点保留用于旧引用兼容，不再显示 ====== */
.results { display: none !important; }

/* ====== 添加网站浮层 ====== */
.modal {
  position: fixed; inset: 0;
  z-index: 60;
  display: flex; align-items: center; justify-content: center;
}
.modal.hidden { display: none; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(2, 3, 10, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  width: min(460px, calc(100% - 40px));
  background: rgba(10, 14, 30, 0.96);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.6), 0 0 0 1px rgba(143,184,255,0.1);
  overflow: hidden;
  animation: modalIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 8px;
}
.modal-head h3 {
  font-family: "Fredoka", "ZCOOL KuaiLe", sans-serif;
  font-size: 17px; font-weight: 600; color: var(--fg);
  letter-spacing: 0.06em;
}
.modal-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--fg-dim); font-size: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, background .2s;
}
.modal-close:hover { color: var(--fg); background: rgba(255,255,255,0.06); }
.modal-body { padding: 6px 22px 20px; }
.field {
  display: block; margin-top: 14px;
}
.field > span {
  display: block;
  font-size: 12px; color: var(--fg-dim);
  margin-bottom: 6px; letter-spacing: 0.08em;
}
.field > span em { color: #ff8aa8; font-style: normal; margin-left: 2px; }
.field > span i { color: rgba(136, 145, 189, 0.7); font-style: normal; font-size: 11px; }
.field input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--stroke);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.field input:focus {
  border-color: rgba(143, 184, 255, 0.6);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 4px rgba(143, 184, 255, 0.12);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px;
}
.btn {
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid var(--stroke);
  background: transparent;
  color: var(--fg);
  transition: all .2s;
  letter-spacing: 0.06em;
}
.btn.ghost { color: var(--fg-dim); }
.btn.ghost:hover { color: var(--fg); border-color: rgba(255,255,255,0.28); }
.btn.primary {
  background: linear-gradient(135deg, #7aa2ff, #b58bff);
  border-color: transparent;
  color: #0a0d20;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.1); box-shadow: 0 8px 24px rgba(143,184,255,0.35); }
.modal-hint {
  margin-top: 10px;
  font-size: 12px;
  color: #ff8aa8;
  min-height: 16px;
}
.modal-hint.ok { color: #7ee0ff; }

/* 导入书签列表 */
.modal-sub {
  font-size: 13px; color: var(--fg-dim);
  margin: 2px 0 14px; letter-spacing: 0.04em;
}
.import-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 240px; overflow-y: auto;
  margin-bottom: 4px;
}
.import-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid var(--stroke);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.import-item:hover { border-color: rgba(143,184,255,0.4); background: rgba(143,184,255,0.08); }
.import-item.selected {
  border-color: rgba(143,184,255,0.7);
  background: rgba(143,184,255,0.14);
  box-shadow: 0 0 0 4px rgba(143,184,255,0.1);
}
.import-item .ii-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #7aa2ff, #b58bff);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: #0a0d20; font-weight: 700;
  flex-shrink: 0;
}
.import-item .ii-main { flex: 1; min-width: 0; }
.import-item .ii-name {
  color: var(--fg); font-size: 14px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.import-item .ii-meta { color: var(--fg-dim); font-size: 11px; margin-top: 2px; letter-spacing: 0.06em; }
.import-empty {
  color: var(--fg-dim); font-size: 13px; text-align: center;
  padding: 24px 10px;
}

/* 导入分隔线 */
.import-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 12px;
  color: var(--fg-dim); font-size: 12px; letter-spacing: 0.1em;
}
.import-divider::before, .import-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(to right, transparent, var(--stroke), transparent);
}
.import-file-row {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,0.03);
  border: 1.5px dashed var(--stroke);
  border-radius: 14px;
}
.import-file-tip {
  font-size: 12px; color: var(--fg-dim); line-height: 1.7;
}
.import-file-tip code {
  background: rgba(143,184,255,0.14);
  color: #c9defa;
  padding: 1px 6px; border-radius: 6px;
  font-size: 11px;
}
.import-file-tip b { color: var(--fg); }
.file-btn { align-self: flex-start; cursor: pointer; }

/* 旧的 hidden-freq 已被 rotating-hidden 替代，保留兼容 */
.star.hidden-freq { display: none; }
.star.hidden-freq.hit { display: block; }

/* 空态引导：两颗巨型星云 */
.empty-guide {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  z-index: 4;
  pointer-events: none;
  animation: fadeInGuide 900ms ease both;
}
.empty-guide.hidden { display: none; }
.empty-guide .guide-hint {
  font-family: 'ZCOOL KuaiLe', 'Fredoka', sans-serif;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: rgba(200, 215, 255, 0.75);
  text-shadow: 0 0 18px rgba(140, 180, 255, 0.35);
}
.guide-stars {
  display: flex;
  gap: 80px;
  flex-wrap: wrap;
  justify-content: center;
  pointer-events: auto;
}
.guide-star {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 44px;
  border-radius: 32px;
  color: var(--fg);
  font-family: 'Fredoka', 'ZCOOL KuaiLe', sans-serif;
  transition: transform .35s ease;
  animation: floatGuide 5s ease-in-out infinite;
}
.guide-star:nth-child(2) { animation-delay: -2.2s; }
.guide-star:hover { transform: scale(1.08) translateY(-4px); }
.guide-star:active { transform: scale(1.02); }
.guide-star .gs-emoji {
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 0 24px rgba(180,160,255,0.6));
}
.guide-star .gs-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-shadow:
    0 0 18px rgba(122,162,255,0.55),
    0 0 36px rgba(181,139,255,0.35);
}
.guide-star .gs-sub {
  font-size: 13px;
  color: var(--fg-dim);
  letter-spacing: 0.12em;
}
.guide-import .gs-title {
  background: linear-gradient(135deg, #9ec0ff, #e2b8ff);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.guide-add .gs-title {
  background: linear-gradient(135deg, #ffd9a3, #ff9edb);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
@keyframes floatGuide {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-12px); }
}
@keyframes fadeInGuide {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 顶部 + 添加按钮 */
.reset.primary {
  background: linear-gradient(135deg, rgba(122,162,255,0.22), rgba(181,139,255,0.22));
  color: var(--fg);
  border-color: rgba(143, 184, 255, 0.35);
}
.reset.primary:hover {
  background: linear-gradient(135deg, rgba(122,162,255,0.35), rgba(181,139,255,0.35));
  color: #fff;
}

/* 右键删除提示 */
.star.removable { cursor: context-menu; }
.star.custom-site::before {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7ee0ff, #b58bff);
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 6px #7ee0ff;
}

/* ====== 底部 ====== */
.hintbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: 40px;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  font-size: 12px; color: var(--fg-dim);
  z-index: 20;
  user-select: none;
  background: linear-gradient(0deg, rgba(2, 3, 10, 0.7) 0%, rgba(2, 3, 10, 0) 100%);
}
.hintbar .sep { opacity: 0.4; }

/* ====== 滚动条 ====== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); }

/* ====== 适配 ====== */
@media (max-width: 720px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .brand .subtitle { display: none; }
  .reset { display: none; }
  .deco-moon { width: 220px; height: 220px; top: 14vh; }
}
