:root {
  --bg: #050a08;
  --green: #00e640;
  --cyan: #00d4ff;
  --yellow: #ffb830;
  --magenta: #ff5e9c;
  --chassis: #1a1d23;
  --text: #c8d6cf;
  --text-bright: #e8f5ed;
}

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

body {
  background: var(--bg);
  min-height: 100vh;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  overflow-x: hidden;
  position: relative;
}

/* 背景画布 */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.65;
}

/* 主示波器容器 —— 使用transform过渡实现流畅缩放 */
.main-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  width: 90vw;
  max-width: 960px;
  z-index: 5;
  transition: transform 1.2s cubic-bezier(0.2, 0.9, 0.3, 1), width 0.8s, max-width 0.8s;
}
/* 缩小到右下角 */
.main-container.shrink {
  top: auto; bottom: 20px;
  left: auto; right: 20px;
  transform: translate(0, 0) scale(0.22);
  width: 160px;
  max-width: 160px;
}

.chassis {
  width: 100%;
  background: var(--chassis);
  border-radius: 18px;
  padding: 10px 10px 14px;
  box-shadow: 0 12px 45px rgba(0, 0, 0, 0.7);
  transition: all 0.8s;
}
.main-container.shrink .chassis {
  padding: 6px;
  border-radius: 12px;
}

.led-strip {
  display: flex;
  gap: 6px;
  padding: 4px 12px 8px;
  margin-bottom: 2px;
}
.led {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #2a3a2a;
  transition: 0.2s;
}
.led.on { background: #00e640; box-shadow: 0 0 8px #00e640; }
.led.warn { background: #ffb830; box-shadow: 0 0 6px #ffb830; }
.led.blue { background: #00d4ff; box-shadow: 0 0 8px #00d4ff; }

.brand-row {
  display: flex; justify-content: space-between;
  padding: 0 12px 4px;
  font-size: 9px; letter-spacing: 1.5px;
  color: #5a6a5e; font-family: 'SF Mono', monospace;
}

/* 屏幕区 */
.screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #040706;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}
.main-container.shrink .screen {
  border-radius: 6px;
}

.scanlines {
  position: absolute; inset: 0; z-index: 15; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.02) 2px, rgba(0,0,0,0.02) 4px);
}
.vignette {
  position: absolute; inset: 0; z-index: 14; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.5) 100%);
}

/* POST/终端层 */
.post-layer, .terminal-layer {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: #020302; color: #a0b8a0;
  font-family: 'SF Mono', monospace; font-size: 15px;
  white-space: pre-wrap; text-align: center;
  transition: opacity 0.8s;
}
.post-layer.fadeOut { opacity: 0; pointer-events: none; }
.terminal-layer {
  background: #0a0e0c; flex-direction: column; padding: 24px 28px;
  color: #b8d8c0; opacity: 1; visibility: visible;
}
.terminal-layer.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.terminal-line {
  opacity: 0; transform: translateY(6px);
  transition: 0.25s; font-size: 14px; line-height: 1.6;
  text-shadow: 0 0 6px rgba(0,200,100,0.3);
}
.terminal-line.show { opacity: 1; transform: translateY(0); }
.prompt { color: #00e640; font-weight: bold; text-shadow: 0 0 12px rgba(0,255,80,0.6); }
.cursor { display: inline-block; width: 8px; height: 16px; background: #00e640; margin-left: 2px; vertical-align: bottom; animation: blink 0.7s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

/* 示波器 Canvas 层 */
.scope-layer {
  position: absolute; z-index: 10; border-radius: 6px;
  top:0; left:0; width:100%; height:100%;
  opacity:0; pointer-events: none;
  transition: opacity 0.5s;
}
.scope-layer.active { opacity:1; }

/* 眼图叠加层 */
.eye-diagram {
  position: absolute;
  bottom: 10px; left: 10px;
  width: 120px; height: 80px;
  background: rgba(0,10,5,0.8);
  border: 1px solid #2a4a32;
  border-radius: 6px;
  display: none;
  z-index: 25;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.eye-diagram.show { display: flex; }
.eye-diagram span {
  font-size: 7px;
  color: #6a9a6a;
  letter-spacing: 1px;
}
#eyeCanvas { width: 100%; height: 60px; }

/* 全屏个人介绍 */
.profile-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 1s 0.3s, transform 1s 0.3s;
  pointer-events: none;
}
.profile-fullscreen.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

.avatar-wrapper { position: relative; width: 90px; height: 90px; margin-bottom: 20px; }
.avatar-ring {
  position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg, rgba(0,220,130,0.7), rgba(0,200,220,0.7), rgba(0,220,130,0.7)) border-box;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  animation: spin 8s linear infinite;
  box-shadow: 0 0 30px rgba(0,200,120,0.5);
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar-img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  background: #1a2a20; position: relative; z-index: 2;
  box-shadow: 0 6px 22px rgba(0,0,0,0.6);
}
.name {
  font-size: 28px; font-weight: 700; color: var(--text-bright);
  letter-spacing: 3px; text-shadow: 0 0 18px rgba(200,240,200,0.6);
  margin-bottom: 6px; display: flex; gap: 2px;
}
.name span { opacity: 0; animation: typeIn 0.04s forwards; }
@keyframes typeIn { to { opacity: 1; } }
.title {
  font-size: 15px; color: #a0c0a8; letter-spacing: 2px;
  margin-bottom: 18px; text-shadow: 0 0 8px rgba(140,200,150,0.4);
  text-align: center; max-width: 600px;
}

.skills {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 6px;
}
.skill-tag {
  background: rgba(10,40,25,0.8); border: 1px solid rgba(0,220,130,0.3);
  color: #b0e0c0; padding: 5px 16px; border-radius: 20px;
  font-size: 12px; letter-spacing: 1.5px;
  display: flex; align-items: center; gap: 6px;
  opacity: 0; transform: scale(0.7);
  animation: popIn 0.35s forwards;
  backdrop-filter: blur(4px);
}
.skill-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: #00e640; box-shadow: 0 0 8px #00e640; }
@keyframes popIn { to { opacity: 1; transform: scale(1); } }

/* 服务器状态 */
.server-status {
  display: flex; gap: 20px; margin-top: 24px;
}
.server-blade {
  background: rgba(10,20,14,0.9);
  border: 1px solid #2a4a2a;
  border-radius: 8px;
  padding: 8px 16px;
  display: flex; gap: 8px; align-items: center;
  color: #a0c0a0; font-size: 11px; letter-spacing: 1px;
}
.blade-led {
  width: 6px; height: 6px; border-radius: 50%;
  background: #2a3a2a;
  animation: ledPulse 2s infinite;
}
.blade-led.green { background: #00e640; box-shadow: 0 0 6px #00e640; }
.blade-led.amber { background: #ffb830; box-shadow: 0 0 6px #ffb830; }
.blade-led.red { background: #ff5e5e; box-shadow: 0 0 6px #ff5e5e; }
@keyframes ledPulse { 0%,100%{opacity:1;} 50%{opacity:0.4;} }

/* 仪器栏 */
.instruments-bar {
  position: fixed; bottom: 20px; left: 20px; z-index: 35;
  display: flex; gap: 16px; opacity: 0; transition: opacity 0.8s 0.8s;
  pointer-events: none;
}
.instruments-bar.visible { opacity: 1; pointer-events: auto; }
.dmm-card, .logic-card {
  background: rgba(10,20,14,0.9); border: 1px solid #2a4a32;
  border-radius: 10px; padding: 8px 14px; backdrop-filter: blur(8px);
}
.dmm-card { display: flex; align-items: center; gap: 12px; color: #b8e0c0; font-family: 'SF Mono', monospace; }
.dmm-value { font-size: 22px; font-weight: bold; color: #ffd780; text-shadow: 0 0 10px #ffb830; }
.logic-card { display: flex; flex-direction: column; gap: 4px; }
.logic-row { display: flex; align-items: center; gap: 6px; }
.logic-label { font-size: 9px; color: #7daa7d; width: 18px; }
.logic-wave { display: flex; gap: 2px; }
.logic-bit { width: 8px; height: 10px; background: #1a3a1a; border-radius: 2px; transition: 0.15s; }
.logic-bit.high { background: #00e640; box-shadow: 0 0 6px #00ff55; }

/* 晶振窗口 */
.crystal-window {
  position: fixed; top: 20px; right: 20px; z-index: 35;
  width: 70px; height: 70px; background: rgba(10,20,14,0.85);
  border: 1px solid #2a4a2a; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  opacity: 0; transition: opacity 0.6s 1s;
  box-shadow: 0 0 14px rgba(0,0,0,0.8);
}
.crystal-window.visible { opacity: 0.9; }
.crystal-label { font-size: 7px; color: #6a9a6a; margin-top: 2px; }
#crystalCanvas { width: 50px; height: 30px; }

/* 彩蛋终端 */
.easter-egg-terminal {
  position: fixed; z-index: 60; inset: 10%;
  background: rgba(5,15,10,0.95); border: 1px solid #00e640;
  border-radius: 10px; display: none; flex-direction: column;
  padding: 16px; font-family: 'SF Mono', monospace; color: #b0d8b0;
  backdrop-filter: blur(10px);
}
.easter-egg-terminal.active { display: flex; }
.easter-output { flex: 1; overflow-y: auto; white-space: pre-wrap; font-size: 13px; margin-bottom: 10px; }
.easter-input-row { display: flex; align-items: center; gap: 6px; }
.easter-input { background: transparent; border: none; color: #00e640; font-family: inherit; font-size: 14px; outline: none; flex: 1; }

.hint-replay {
  position: fixed; bottom: 20px; right: 20px; z-index: 55;
  font-family: 'SF Mono', monospace; font-size: 10px;
  color: rgba(180,210,190,0.5); cursor: pointer;
  transition: 0.3s; opacity: 0;
}
.hint-replay.show { opacity: 1; }
.hint-replay:hover { color: #00e640; text-shadow: 0 0 12px #00ff55; }

/* 鼠标探针效果（在示波器上移动时显示） */
.probe-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  display: none;
  width: 20px; height: 20px;
  border: 1px solid #00e640;
  border-radius: 50%;
  background: rgba(0,230,100,0.15);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px #00e640;
}
.probe-value {
  position: absolute;
  pointer-events: none;
  z-index: 51;
  display: none;
  font-family: 'SF Mono', monospace;
  font-size: 10px;
  color: #00e640;
  background: rgba(0,0,0,0.7);
  padding: 2px 5px;
  border-radius: 3px;
}