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

:root {
  --bg: #000;
  --bg-card: rgba(8, 14, 8, 0.85);
  --bg-card-hover: rgba(12, 22, 12, 0.95);
  --border: #1c3a1f;
  --text: #b8ffc4;
  --text-dim: #3f9d4f;
  --accent: #00ff41;
}

body {
  background: #000;
  color: var(--text);
  font-family: "Consolas", "Courier New", "PingFang SC", monospace;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ===== CRT 扫描线 + 暗角 ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%);
}

::selection {
  background: var(--accent);
  color: #000;
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #000;
}

::-webkit-scrollbar-thumb {
  background: #17351b;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #1f4a25;
}

/* ===== 代码雨画布（雨 + 日志流双层） ===== */
#rain,
#log {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -2;
}

/* ===== 头部 ===== */
.site-header {
  text-align: center;
  padding: 72px 20px 36px;
}

.site-header h1 {
  font-size: 2.6rem;
  letter-spacing: 4px;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.6), 0 0 30px rgba(0, 255, 65, 0.3);
}

.site-header p {
  color: var(--text-dim);
  margin-top: 10px;
  font-size: 0.95rem;
}

/* 终端闪烁光标 */
.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* 用户偏好减少动态效果时：关闪烁、去扫描线 */
@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
    opacity: 1;
  }

  body::before {
    display: none;
  }

  .card,
  .card:hover {
    transition: none;
    transform: none;
  }
}

/* ===== 分组容器 ===== */
.groups {
  flex: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 24px 48px;
  width: 100%;
}

.group {
  margin-bottom: 40px;
}

.group-title {
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.4);
}

.group-title::before {
  content: "> ";
  color: var(--text-dim);
}

/* ===== 卡片网格 ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(0, 255, 65, 0.35), inset 0 0 8px rgba(0, 255, 65, 0.08);
  transform: translateY(-2px);
}

.card-placeholder {
  border-style: dashed;
  cursor: default;
}

.card-placeholder:hover {
  background: var(--bg-card);
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.card-icon {
  font-size: 1.7rem;
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(0, 255, 65, 0.5));
}

.card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #d8ffdf;
}

.card:hover .card-title {
  color: var(--accent);
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 全局搜索框（页脚上方，居中） ===== */
#global-search {
  display: flex;
  gap: 8px;
  width: 520px;
  max-width: calc(100vw - 32px);
  margin: 40px auto 0;
  padding: 10px;
  background: rgba(4, 14, 7, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 0 18px rgba(0, 255, 65, 0.15), inset 0 0 10px rgba(0, 255, 65, 0.05);
  backdrop-filter: blur(6px);
}

#global-search input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #050e07;
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#global-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

#global-search button {
  flex-shrink: 0;
  padding: 9px 20px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: #02150a;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

#global-search button:hover {
  filter: brightness(1.2);
  transform: translateY(-1px);
}

#global-search button:active {
  transform: translateY(0);
}

@media (max-width: 600px) {
  #global-search {
    margin: 28px 16px 0;
    width: auto;
  }
}

/* ===== 页脚 ===== */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.site-footer::before {
  content: "$ ";
  color: var(--accent);
}

/* ===== 电路芯片水印（右侧 1/3，呼吸渐隐渐显） ===== */
#hacker-face {
  position: fixed;
  right: 0;
  bottom: 0;
  z-index: -1;
  width: 20vw;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 0 10px rgba(0, 255, 65, 0.4));
  animation: breathe 8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.28;
  }
}

@media (prefers-reduced-motion: reduce) {
  #hacker-face {
    animation: none;
    opacity: 0.25;
  }
}

@media (max-width: 600px) {
  #hacker-face {
    width: 220px;
    right: -40px;
    bottom: -40px;
  }
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .site-header {
    padding-top: 44px;
  }

  .site-header h1 {
    font-size: 2rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}
