:root {
  --bg-color: #0d0e12;
  --card-bg: #16181d;
  --text-primary: #e0e0e0;
  --text-secondary: #8a8f98;
  --accent-color: #00ff9d; /* 终端绿 */
  --accent-secondary: #58a6ff; /* 链接蓝 */
  --border-color: #2d313a;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --font-sans: system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 网格背景图案 */
#matrix-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  opacity: 0.15;
  pointer-events: none;
}

.grid-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -1;
  pointer-events: none;
}

/* 布局 - Bento Grid 网格 */
.layout {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto auto;
  gap: 16px;
  max-width: 1000px;
  width: 100%;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--text-secondary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* 个人资料卡片 */
.profile-card {
  grid-column: span 1;
  grid-row: span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-container {
  position: relative;
  margin-bottom: 16px;
}

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  object-fit: cover;
}

.status-indicator {
  position: absolute;
  bottom: 5px;
  right: 5px;
  width: 14px;
  height: 14px;
  background: var(--accent-color);
  border-radius: 50%;
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 8px var(--accent-color);
}

.name {
  font-size: 1.5rem;
  margin: 0 0 8px;
  font-weight: 700;
}

.role-tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.role-tags span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-secondary);
}

.bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.highlight {
  color: var(--accent-secondary);
  font-weight: 500;
}

.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.btn.primary {
  background: var(--accent-color);
  color: #000;
}

.btn.primary:hover {
  background: #00e68e;
}

.btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 终端卡片 */
.terminal-card {
  grid-column: span 2;
  font-family: var(--font-mono);
  display: flex;
  flex-direction: column;
  background: #000;
  border: 1px solid #333;
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  border-bottom: 1px solid #333;
  padding-bottom: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.terminal-title {
  margin-left: auto;
  font-size: 0.8rem;
  color: #666;
}

.terminal-body {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #ccc;
  overflow-y: auto; /* 允许滚动 */
  max-height: 280px; /* 限制高度 */
  scrollbar-width: none; /* 为了美观隐藏滚动条 */
}

.terminal-body::-webkit-scrollbar {
  display: none;
}

.line {
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 1.2em;
  background-color: var(--accent-color);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* 状态卡片 */
.stats-card {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
}

/* 项目卡片 */
.projects-card {
  grid-column: span 3;
}

.section-title {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0 0 20px;
  text-transform: uppercase;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.project-item:hover {
  border-color: var(--accent-secondary);
}

.project-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.project-item h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.project-item p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* 链接卡片 */
.links-card {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
}

.link-list {
  list-style: none;
  padding: 0;
  margin: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color 0.2s;
}

.link-list a:hover {
  color: var(--accent-secondary);
}

.arrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.keywords-box {
  margin-top: 20px;
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.4;
  opacity: 0.6;
}

/* 响应式适配 */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .profile-card { grid-column: span 2; grid-row: auto; }
  .terminal-card { grid-column: span 2; }
  .stats-card { grid-column: span 2; flex-direction: row; gap: 20px; }
  .projects-card { grid-column: span 2; }
  .links-card { grid-column: span 1; }
  .tech-card { grid-column: span 1; }
  .services-card { grid-column: span 1; }
  .activity-card { grid-column: span 1; }
}

/* 技术栈卡片 */
.tech-card {
  grid-column: span 1;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.tech-grid span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.tech-grid span:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

/* 服务卡片 */
.services-card {
  grid-column: span 1;
}

.service-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-primary);
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
}

.service-list .icon {
  font-size: 1.1rem;
}

/* 动态日志卡片 */
.activity-card {
  grid-column: span 1;
  display: flex;
  flex-direction: column;
  max-height: 240px;
  overflow: hidden;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.activity-header .section-title {
  margin: 0;
}

.live-badge {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  padding: 2px 6px;
  border-radius: 4px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

.log-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow-y: hidden;
  position: relative;
}

.log-item {
  display: flex;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}

.log-time {
  color: #666;
  min-width: 40px;
}

.log-msg {
  color: var(--text-primary);
}

/* 弹窗样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--accent-color);
  width: 90%;
  max-width: 400px;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 255, 157, 0.2);
  font-family: var(--font-mono);
  overflow: hidden;
  transform: translateY(-20px);
  animation: slideDown 0.4s forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  to { transform: translateY(0); }
}

.modal-header {
  background: rgba(0, 0, 0, 0.3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-title {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--accent-color);
  letter-spacing: 1px;
}

.modal-body {
  padding: 24px;
  text-align: center;
}

.modal-body h3 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 1.4rem;
}

.modal-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.modal-stats {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  border: 1px dashed var(--border-color);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.stat-row:last-child {
  margin-bottom: 0;
}

.full-width {
  width: 100%;
  padding: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
}

/* 响应式更新 */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .profile-card { grid-column: span 2; grid-row: auto; }
  .terminal-card { grid-column: span 2; }
  .stats-card { grid-column: span 2; flex-direction: row; gap: 20px; }
  .projects-card { grid-column: span 2; }
  .links-card { grid-column: span 1; }
  .tech-card { grid-column: span 1; }
  .services-card { grid-column: span 1; }
  .activity-card { grid-column: span 1; }
}

@media (max-width: 600px) {
  body { padding: 10px; }
  .project-grid { grid-template-columns: 1fr; }
  .stats-card { justify-content: space-around; }
  .links-card, .tech-card, .services-card, .activity-card { grid-column: span 2; }
}
