/* ============================================================
   EE TOOLBOX · 电气工程工具箱
   主题：深色图纸底 + PCB 项目卡片（缺角矩形 + 铭牌 + 终端屏）
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --panel: #0d1424;
  --line: #1f2a3d;
  --text: #e8ecf5;
  --dim: #8b96ab;
  --accent: #37e06f;
  --gold: #d9b45b;
  --mono: "Share Tech Mono", "Consolas", "Courier New", monospace;
  --tech: "Orbitron", "Segoe UI", sans-serif;
  --boardA: #14603c;
  --boardB: #0b4529;
  --screenTxt: #8dff6e;
  --glow: rgba(141, 255, 110, 0.28);
}

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

html { scrollbar-color: #2a3a55 var(--bg); }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景：蓝图纸网格 ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(55, 224, 111, .06), transparent 60%),
    linear-gradient(rgba(120, 150, 200, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 200, .07) 1px, transparent 1px),
    repeating-linear-gradient(45deg, rgba(120, 150, 200, .025) 0 1px, transparent 1px 22px);
  background-size: 100% 100%, 34px 34px, 34px 34px, 100% 100%;
}

::selection { background: rgba(55, 224, 111, .35); }

/* ---------- 头部 ---------- */
.site-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 28px; padding: 36px 5vw 26px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 25, 45, .85), rgba(10, 14, 26, 0));
}

.header-left { flex: 1; min-width: 0; }

.logo-row { display: flex; align-items: center; gap: 14px; }

.logo-badge {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle at 35% 30%, #1c2a44, #0c1424 70%);
  border: 1px solid var(--gold);
  box-shadow: 0 0 14px rgba(217, 180, 91, .25), inset 0 0 8px rgba(0, 0, 0, .8);
}

h1 {
  font-family: var(--tech); font-size: 34px; letter-spacing: 3px; font-weight: 900;
}
.title-accent { color: var(--accent); text-shadow: 0 0 18px rgba(55, 224, 111, .55); }

.tagline {
  margin-top: 8px; color: var(--dim); font-size: 14px; letter-spacing: 1px;
}
.tagline-cursor { color: var(--accent); animation: blink 1.1s steps(1, end) infinite; }

.waveform { display: block; width: 100%; max-width: 560px; height: 46px; margin-top: 14px; }
.wave-line {
  fill: none; stroke: var(--accent); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(55, 224, 111, .55));
  stroke-dasharray: 100; stroke-dashoffset: 100;
  animation: draw 2.6s ease-out .3s forwards, pulse 2.6s ease-in-out 3s infinite;
}
.wave-grid {
  fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 1; stroke-dasharray: 4 6;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------- 状态面板（万用表读屏风） ---------- */
.status-panel {
  min-width: 250px; padding: 14px 18px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(0, 0, 0, .4);
}
.status-title {
  font-family: var(--tech); font-size: 11px; letter-spacing: 2px; color: var(--gold);
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 10px;
}
.status-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--dim); letter-spacing: 1px; padding: 3px 0;
}
.status-row b {
  color: var(--accent); font-weight: 400; text-shadow: 0 0 8px rgba(55, 224, 111, .5);
}
#stat-projects { font-size: 20px; letter-spacing: 4px; }

/* ---------- 主体 ---------- */
main { padding: 30px 5vw 60px; max-width: 1500px; margin: 0 auto; }

.section-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head h2 { font-size: 21px; letter-spacing: 1px; }
.section-sub { font-family: var(--tech); font-size: 11px; letter-spacing: 3px; color: var(--gold); }
.section-hint { color: var(--dim); font-size: 12px; }
.section-hint code {
  background: #17203a; border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; color: #c9d7f2; font-family: var(--mono);
}

/* ---------- PCB 卡片面板 ---------- */
.board {
  display: grid; gap: 26px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* 板子配色（真实 PCB 常见的绿/蓝/红/紫阻焊） */
.p-green  { --boardA: #14603c; --boardB: #0b4529; --screenTxt: #8dff6e; --glow: rgba(141, 255, 110, .28); }
.p-blue   { --boardA: #14586e; --boardB: #0e3d4f; --screenTxt: #6fd8ff; --glow: rgba(111, 216, 255, .28); }
.p-red    { --boardA: #6e2030; --boardB: #4f1723; --screenTxt: #ff9c82; --glow: rgba(255, 156, 130, .28); }
.p-purple { --boardA: #4a2a6e; --boardB: #35205a; --screenTxt: #d3a8ff; --glow: rgba(211, 168, 255, .28); }

.tool-card {
  transition: transform .22s ease, filter .25s ease;
}
.tool-card:hover { transform: translateY(-4px); }
.tool-card:hover {
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, .5)) drop-shadow(0 0 16px var(--glow));
}

/* 缺角矩形 PCB：切右上角 */
.card-link {
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  height: 252px; padding: 15px 15px 17px;
  text-decoration: none; color: var(--text);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .03) 0 2px, transparent 2px 13px),
    linear-gradient(163deg, var(--boardA), var(--boardB));
  border: 1px solid rgba(217, 180, 91, .5);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(0, 0, 0, .28);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 0 100%);
  outline: none;
}
.card-link:focus-visible { border-color: var(--accent); border-width: 2px; }

/* 缺角处的安装孔（贴合 45° 切角斜边内侧，避免被 clip 裁切） */
.mount-hole {
  position: absolute; top: 8.5px; right: 8.5px; z-index: 3;
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 42% 38%, #7a838f 0 16%, #1a1f27 52%, #05070a 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .07);
}

/* 丝印位号（板边小字） */
.silk {
  position: absolute; left: 11px; top: 11px; z-index: 2;
  font-size: 9px; letter-spacing: .8px; color: rgba(255, 255, 255, .38);
  text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}

/* ---------- 顶部铭牌（圆角金属标牌） ---------- */
.nameplate {
  position: relative; display: flex; align-items: center; gap: 8px;
  align-self: center; width: 82%; flex: 0 0 auto;
  padding: 9px 18px; border-radius: 15px 15px 4px 4px;
  background: linear-gradient(180deg, #f6ecd2 0%, #e8d7ab 55%, #cdb279 100%);
  color: #241b0c;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .75),
    inset 0 -2px 4px rgba(0, 0, 0, .18),
    0 2px 5px rgba(0, 0, 0, .4);
}
/* 铭牌两侧螺丝 */
.nameplate::before, .nameplate::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background:
    linear-gradient(45deg, transparent 42%, rgba(0, 0, 0, .45) 42% 58%, transparent 58%),
    linear-gradient(-45deg, transparent 42%, rgba(0, 0, 0, .45) 42% 58%, transparent 58%),
    radial-gradient(circle at 50% 45%, #9fb0bf 0 30%, #46525e 62%, #232a32 100%);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}
.nameplate::before { left: 7px; }
.nameplate::after { right: 7px; }

.plate-icon { font-size: 16px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.plate-name {
  flex: 1; min-width: 0; text-align: center;
  font-size: 15px; font-weight: 700; letter-spacing: .5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
}
.plate-ver {
  font-size: 10px; font-weight: 500; color: #5d4a25; letter-spacing: 1px;
}

/* ---------- 单片机终端屏幕 ---------- */
.screen {
  flex: 1; min-height: 0; position: relative;
  border-radius: 7px; padding: 12px 14px;
  background: linear-gradient(180deg, #05130a, #040f0a);
  border: 1px solid #153520;
  box-shadow: inset 0 0 22px rgba(0, 0, 0, .9), inset 0 0 6px rgba(0, 0, 0, .6);
  overflow: hidden;
}
/* 扫描线 */
.screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px);
}
/* 玻璃反光 */
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, .07) 0%, transparent 26%);
}

.screen-inner {
  position: relative; z-index: 1; height: 100%; overflow: hidden;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.62;
  color: var(--screenTxt);
  text-shadow: 0 0 7px currentColor;
  white-space: pre-wrap; word-break: break-word;
}

.cursor { display: inline-block; animation: blink 1.05s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 空状态 / 设置提示卡 ---------- */
.setup-card {
  grid-column: 1 / -1;
  border: 1px dashed var(--gold);
  border-radius: 14px 14px 4px 4px;
  background: linear-gradient(163deg, #14603c, #0b4529);
  padding: 26px 30px;
}
.setup-card h3 { font-size: 17px; margin-bottom: 12px; color: #f3e9d2; }
.setup-card h3 code, .setup-card li code {
  background: rgba(0, 0, 0, .3); border-radius: 4px; padding: 1px 6px; color: #ffe9b0;
}
.setup-card ol { margin-left: 20px; line-height: 2; color: #cfe8d8; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 50;
  max-width: 340px; padding: 12px 18px;
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 8px; color: var(--accent); font-size: 13px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .5);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ---------- 页脚 ---------- */
footer { text-align: center; padding: 26px 5vw 34px; border-top: 1px solid var(--line); color: var(--dim); }
.footer-line { font-size: 12.5px; letter-spacing: 1px; }
.footer-line code { color: #c9d7f2; }
.footer-sub { margin-top: 8px; font-size: 10.5px; letter-spacing: 2px; opacity: .7; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .site-header { flex-direction: column; }
  .status-panel { width: 100%; min-width: 0; }
  h1 { font-size: 27px; }
  .board { grid-template-columns: 1fr; }
  .nameplate { width: 88%; }
}

@media (prefers-reduced-motion: reduce) {
  .wave-line, .tagline-cursor, .cursor { animation: none !important; }
  .wave-line { stroke-dashoffset: 0; }
}
