未命名 mJyGqjedit icon

作者:
藤原
Fork(复制)
下载
嵌入
设置
BUG反馈
index.html
现在支持上传本地图片了!
            
            <!DOCTYPE html>
<html lang="zh-CN" data-theme="dark">
<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>TENG YUAN - 个人主页</title>
  <meta name="description" content="藤原的个人主页,分享技术、生活和创意">
  <meta name="keywords" content="藤原,个人主页,前端开发,技术博客">
  
  <!-- 预连接优化 -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link rel="preconnect" href="https://cdn.jsdelivr.net">
  
  <!-- 字体加载 -->
  <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@300..700&display=swap" rel="stylesheet">
  <link href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900&display=swap" rel="stylesheet">
  
  <!-- 图标库 -->
  <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.4.0/css/all.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.min.css" rel="stylesheet">
  
  <!-- JavaScript 库 -->
  <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/file-saver@2.0.5/dist/FileSaver.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/jszip@3.10.1/dist/jszip.min.js"></script>
  
  <!-- 主题颜色 -->
  <meta name="theme-color" content="#799fb4">
  
  <!-- 苹果全屏模式 -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  
  <!-- 微软磁贴颜色 -->
  <meta name="msapplication-TileColor" content="#799fb4">
  
  <!-- 网站图标 -->
  <link rel="icon" href="favicon.ico" type="image/x-icon">
  <link rel="apple-touch-icon" href="apple-touch-icon.png">
  <link rel="manifest" href="site.webmanifest">
  
  <style>
/****************************************
 * 重置样式
 *****************************************/
* {
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  font-size: 100%;
  vertical-align: baseline;
  box-sizing: border-box;
  transition: all ease 0.25s;
  -moz-transition: all ease 0.25s;
}

*:focus, button, textarea, .forminput {
  outline: none !important;
  border: unset;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
  display: block;
}

ol, ul {
  list-style: none;
}

blockquote, q {
  quotes: none;
}

blockquote:before, blockquote:after, q:before, q:after {
  content: "";
}

/* 隐藏损坏的链接和图片 */
img[src="<i>No Information</i>"],
img[src="/placeholder.svg"],
a[href="<i>No Information</i>"],
a[href=""]:not([name]):not([onclick]) {
  display: none !important;
}

/* 调整表情符号大小 */
a[href*="javascript:emoticon"] img,
div.postcolor img[alt*="https"],
td[class*="post"] img[alt*="https"],
a[href*="javascript:add_smilie"] img,
#ucpcontent img[alt*="https"],
div.box img[alt*="https"] {
  height: 30px;
}

/****************************************
 * 默认样式
 *****************************************/
body, html {
  margin: 0px;
  padding: 0px;
  scroll-behavior: smooth;
  font: 500 16px/150% var(--fontBody);
  color: var(--dark);
}

body {
  background: linear-gradient(
      360deg,
      RGBA(var(--accentRGB), 0.35) 0%,
      RGBA(var(--lighterRGB), 1) 70%
    ),
    linear-gradient(
      135deg,
      RGBA(var(--supportRGB), 0.35) 10%,
      RGBA(var(--supportRGB), 0) 80%
    ),
    linear-gradient(
      225deg,
      RGBA(var(--featureRGB), 0.35) 10%,
      RGBA(var(--featureRGB), 0) 80%
    ),
    linear-gradient(
      315deg,
      RGBA(var(--supportRGB), 0.35) 100%,
      RGBA(var(--supportRGB), 0) 70%
    );
  background-attachment: fixed;
  background-size: cover;
}

a {
  text-decoration: none;
  cursor: crosshair;
}

/****************************************
 * CSS变量定义
 *****************************************/
:root {
  --headerImage: url(https://i.pinimg.com/564x/d6/58/69/d658698ffbead28c9b23f72d158f2621.jpg);
  --headerHeight: 605px;
  --settingImage: url(https://i.pinimg.com/564x/b5/86/27/b5862702803e0c90b4b4ec3bbec000e8.jpg);
  --fontBody: Quicksand, Source Serif Pro;
  --fontTitle: MontgroveItalic;
  
  /* 默认主题色 */
  --accent: #799fb4;
  --accentRGB: 121, 159, 180;
  --support: #99ccff;
  --supportRGB: 186, 132, 130;
  --feature: #a6b0b4;
  --featureRGB: 166, 176, 180;
  --neutral: #9d8a80;
  --neutralRGB: 157, 138, 128;
  --dark: #1c1a1a;
  --darkRGB: 28, 26, 26;
  --darker: #101010;
  --darkerRGB: 16, 16, 16;
  --lighter: #e2e2e2;
  --lighterRGB: 226, 226, 226;
  --light: #d2d2d2;
  --lightRGB: 210, 210, 210;
  
  /* 这些颜色不会随主题切换变化 */
  --lightest: #ffffff;
  --lightestRGB: 225, 225, 225;
  --darkest: #101010;
  --darkestRGB: 16, 16, 16;
  
  /* 终端相关变量 */
  --editor-bg: RGBA(var(--accentRGB), 0.1);
  --editor-secondary-bg: RGBA(var(--supportRGB), 0.1);
  --line-color: var(--accent);
  --text-color: var(--dark);
  --keyword-color: var(--support);
  --string-color: var(--feature);
  --comment-color: RGBA(var(--accentRGB), 0.7);
  --number-color: var(--accent);
  --function-color: var(--support);
  --font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
  --header-bg: RGBA(var(--accentRGB), 0.2);
  --window-btn-close: #ff5f56;
  --window-btn-min: #ffbd2e;
  --window-btn-max: #27c93f;
  --ai-output-color: var(--dark);
  --user-input-color: var(--support);
  --video-bg: #000000;
  --terminal-accent-color: var(--support);
  --terminal-accent-hover: var(--feature);
  --box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  --border-radius: 15px;
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --tool-header-height: 40px;
  --tool-padding: 16px;
  --terminal-border: 1px solid RGBA(var(--accentRGB), 0.3);
  --border: RGBA(var(--darkRGB), 0.15);
  --borderAlt: RGBA(var(--darkRGB), 0.1);
}

/* 深色主题变量 */
[data-theme="dark"] {
  --dark: #e2e2e2;
  --darkRGB: 226, 226, 226;
  --darker: #d2d2d2;
  --darkerRGB: 210, 210, 210;
  --lighter: #2a2828;
  --lighterRGB: 42, 40, 40;
  --light: #101010;
  --lightRGB: 16, 16, 16;
  
  /* 终端深色主题调整 */
  --editor-bg: RGBA(var(--accentRGB), 0.05);
  --editor-secondary-bg: RGBA(var(--supportRGB), 0.05);
  --line-color: var(--accent);
  --text-color: var(--light);
  --keyword-color: var(--support);
  --string-color: var(--feature);
  --comment-color: RGBA(var(--accentRGB), 0.5);
  --header-bg: RGBA(var(--accentRGB), 0.1);
  --terminal-accent-color: var(--support);
  --terminal-accent-hover: var(--feature);
}

/****************************************
 * 字体定义
 *****************************************/
@font-face {
  font-family: "MontgroveItalic";
  src: url("https://files.jcink.net/uploads2/killingfloor/fonts/Montgrove_Italic.woff")
    format("woff");
  font-display: swap;
}

@font-face {
  font-family: "Huova";
  src: url("https://assets.codepen.io/3254510/Huova.otf") format("opentype");
}

@font-face {
  font-family: "HuovaOutline";
  src: url("https://assets.codepen.io/3254510/HuovaOutline.otf")
    format("opentype");
}

/****************************************
 * 主容器样式
 *****************************************/
#headerWave {
  position: fixed;
  z-index: -1;
}

#boardWrapper {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  width: clamp(450px, 100%, 1300px);
  margin: auto;
  min-height: 100vh;
}

/****************************************
 * 侧边栏样式
 *****************************************/
#boardSidebar {
  position: relative;
  z-index: 999;
  display: flex;
  flex-direction: column;
  padding: 15px;
  color: var(--neutral);
  font: 600 18px/120% var(--fontBody);
  background: var(--light);
  box-shadow: 0px 0px 50px -10px RGBA(000, 000, 000, 0.25);
}

#boardSidebar label {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 20px;
}

#boardSidebar dark i,
#boardSidebar light i {
  color: var(--dark);
}

.stickyBar {
  position: sticky;
  top: 20px;
}

.stickyBar .icons {
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 25px;
}

.stickyBar .icons > div {
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.stickyBar .icons > div:hover {
  background: var(--accent);
  color: var(--lightest);
  transform: scale(1.1);
}

.stickyBar .icons i {
  font-size: 18px;
  color: var(--dark);
}

.stickyBar .icons > div:hover i {
  color: var(--lightest);
}

/* 主题切换按钮样式 */
.theme-switch {
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.theme-switch:hover {
  background: var(--accent);
  color: var(--lightest);
  transform: scale(1.1);
}

.theme-switch input[type="checkbox"] {
  display: none;
}

#theme_switch_click #checkbox,
#theme_switch_click > light,
#theme_switch_click > dark {
  display: none;
}

[data-theme="light"] #theme_switch_click > light,
[data-theme="dark"] #theme_switch_click > dark {
  display: flex !important;
}

/****************************************
 * 内容区域样式
 *****************************************/
#innerWrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--light);
  min-height: 100vh;
  box-shadow: 0px 0px 50px -10px RGBA(000, 000, 000, 0.25);
  overflow: clip;
}

/****************************************
 * 顶部导航栏样式
 *****************************************/
#topbarBacking {
  position: sticky;
  z-index: 9990;
  top: 0px;
  width: 100%;
  height: 50px;
  background: var(--light);
  margin-bottom: -50px;
  box-shadow: 0px 0px 50px -10px RGBA(000, 000, 000, 0.35);
}

#boardTopbar {
  position: sticky;
  top: 0px;
  z-index: 9990;
  width: intrinsic;
  width: -moz-max-content;
  width: -webkit-max-content;
  padding: 15px 30px 15px 30px;
  background-color: var(--light);
  box-shadow: 0px 0px 50px -10px RGBA(000, 000, 000, 0.35);
  border-radius: 0px 0px 20px 0px;
}

#boardTopbar:after {
  content: "";
  position: absolute;
  z-index: 9990;
  right: -34px;
  top: 0px;
  width: 50px;
  height: 50px;
  background: var(--light);
  pointer-events: none;
}

#boardTopbar:before {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: 10px;
  right: -40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--light);
  transform: rotate(172deg);
}

#desktopTopbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#desktopTopbar:before {
  content: "";
  position: absolute;
  z-index: 9990;
  top: 85px;
  left: -31px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--light);
  transform: rotate(172deg);
}

#desktopTopbar .memberAvatar {
  width: 70px;
  height: 70px;
  background-color: var(--accent);
  background-size: cover;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

#desktopTopbar .memberAvatar:hover {
  cursor: crosshair;
}

#desktopTopbar .memberAvatar img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
}

#desktopTopbar .memberAvatar:active {
  transform: translateY(10px) scale(0.99);
}

#desktopTopbar .memberInfo {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-transform: uppercase;
  gap: 10px;
}

#desktopTopbar .memberInfo a {
  color: var(--dark);
}

#desktopTopbar .memberInfo span {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  font: 800 25px/120% var(--fontTitle);
  color: var(--dark);
}

#desktopTopbar .memberInfo {
  font: 600 25px/80% var(--fontBody);
}

#desktopTopbar .memberLinks {
  display: flex;
  gap: 25px;
}

#desktopTopbar .userLinks {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

#desktopTopbar .memberLinks a {
  text-transform: uppercase;
}

#desktopTopbar .memberLinks a:hover i {
  transform: scale(1.1);
}

#desktopTopbar .memberLinks a i {
  color: var(--neutral);
  font-size: 20px;
}

/****************************************
 * 导航栏样式
 *****************************************/
#boardNavigation {
  position: sticky;
  z-index: 9990;
  top: 50px;
  right: 0px;
}

#boardNavigation br {
  display: none;
}

#navstrip {
  position: absolute;
  top: -50px;
  right: 0px;
  display: flex;
  gap: 5px;
  justify-content: center;
  align-items: center;
  background: var(--accent);
  color: var(--lightest);
  padding: 13px;
  border-radius: 0px 0px 0px 15px;
}

#navstrip:before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0px;
  left: -40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--accent);
  transform: rotate(274deg);
}

#navstrip a {
  color: var(--lightest);
}

/****************************************
 * 用户导航菜单样式(终端)
 *****************************************/
#linkmenu-container {
  position: fixed;
  z-index: 9989;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}

#linkmenu {
  position: fixed;
  z-index: 9989;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: RGBA(var(--lightRGB), 0.9);
  backdrop-filter: blur(10px);
  visibility: hidden;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

#linkmenu.show {
  visibility: visible;
  pointer-events: auto;
}

/* 终端样式 */
#terminal-container {
  position: relative;
  width: 90%;
  max-width: 900px;
  height: 80%;
  max-height: 700px;
  z-index: 9999;
  background: var(--editor-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  border: var(--terminal-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(5px);
}

/* 终端编辑器样式 */
.editor {
  width: 100%;
  height: 100%;
  background: var(--editor-bg);
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  border: var(--terminal-border);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(5px);
}

.editor-header {
  background: var(--header-bg);
  padding: 12px;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: var(--terminal-border);
}

.window-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  cursor: pointer;
}

.close { background: var(--window-btn-close); }
.minimize { background: var(--window-btn-min); }
.maximize { background: var(--window-btn-max); }

.title-bar {
  color: var(--line-color);
  margin-left: 20px;
  font-size: 0.9em;
  font-family: var(--fontBody);
  font-weight: 600;
}

.editor-content {
  padding: 20px;
  counter-reset: line;
  font-size: 14px;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  font-family: var(--font-family);
  background: transparent;
}

.editor-content::-webkit-scrollbar {
  display: none;
}

.line {
  display: flex;
  padding: 2px 0;
  position: relative;
  min-height: 1.6em;
}

.line::before {
  counter-increment: line;
  content: counter(line);
  color: var(--line-color);
  width: 2em;
  text-align: right;
  padding-right: 1em;
  position: absolute;
  opacity: 0.7;
  font-family: var(--font-family);
}

.line-content {
  padding-left: 3em;
  width: 100%;
  font-family: var(--font-family);
}

.indent { margin-left: 2em; }
.indent-2 { margin-left: 4em; }
.keyword { color: var(--keyword-color); font-weight: 600; }
.string { color: var(--string-color); }
.comment { color: var(--comment-color); font-style: italic; }
.number { color: var(--number-color); }
.function { color: var(--function-color); font-weight: 600; }
.ai-output { color: var(--ai-output-color); }
.user-input { color: var(--user-input-color); font-weight: 600; }

.input-line {
  display: flex;
  align-items: center;
  background: var(--editor-secondary-bg);
  padding: 8px 10px;
  border-radius: 4px;
  margin: 0 20px 20px;
  position: sticky;
  bottom: 0;
  z-index: 10;
  border-top: var(--terminal-border);
}

.input-line::before {
  content: ">";
  color: var(--terminal-accent-color);
  width: 2em;
  text-align: right;
  padding-right: 1em;
  font-weight: bold;
}

.input-line input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  padding: 2px 0;
}

/* 通用工具容器样式 */
.tool-container {
  background: var(--editor-secondary-bg);
  border-radius: var(--border-radius);
  margin: 15px 0;
  border: var(--terminal-border);
  overflow: hidden;
  backdrop-filter: blur(5px);
  width: 100%;
  max-width: 100%;
}

/* 通用工具头部样式 */
.tool-header {
  background: var(--header-bg);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--terminal-border);
}

.tool-title {
  color: var(--text-color);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-close {
  background: none;
  border: none;
  color: var(--line-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.tool-close:hover {
  color: var(--text-color);
  background: RGBA(var(--accentRGB), 0.1);
}

/* 通用工具内容样式 */
.tool-content {
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* 通用输入区域样式 */
.tool-input {
  width: 100%;
  padding: 12px 50px 12px 16px;
  border: var(--terminal-border);
  border-radius: 8px;
  background: var(--editor-secondary-bg);
  color: var(--text-color);
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.tool-input:focus {
  border-color: var(--terminal-accent-color);
  box-shadow: 0 0 0 3px RGBA(var(--supportRGB), 0.2);
}

/* 通用按钮样式 */
.tool-btn {
  background: var(--terminal-accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.tool-btn:hover {
  background: var(--terminal-accent-hover);
  transform: translateY(-1px);
}

/* 视频播放器样式*/
.video-container {
  background: var(--video-bg);
  border-radius: var(--border-radius);
  margin: 15px 0;
  overflow: hidden;
  border: var(--terminal-border);
  width: 100%;
}

.video-player {
  position: relative;
  width: 100%;
  height: 300px;
  background: #000;
}

.video-player video, .video-player iframe {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: none;
}

.video-controls {
  background: var(--editor-secondary-bg);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.video-button {
  background: var(--terminal-accent-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.video-button:hover {
  background: var(--terminal-accent-hover);
}

/* 搜索结果样式 */
.search-results {
  background: var(--editor-bg);
  border-radius: var(--border-radius);
  margin: 15px 0;
  border: var(--terminal-border);
  overflow: hidden;
  width: 100%;
}

.search-result-item {
  padding: 12px;
  margin-bottom: 10px;
  background: RGBA(var(--accentRGB), 0.05);
  border-radius: 8px;
  border: var(--terminal-border);
  cursor: pointer;
}

.search-result-item:hover {
  background: RGBA(var(--accentRGB), 0.1);
  transform: translateY(-1px);
}

/* 通用信息展示样式 */
.tool-info {
  background: RGBA(var(--supportRGB), 0.1);
  border: 1px solid RGBA(var(--supportRGB), 0.3);
  border-radius: 6px;
  padding: 12px;
  margin: 10px 0;
  color: var(--text-color);
  font-size: 13px;
}

/* 图片预览区域样式 */
.tool-preview-container {
  position: relative;
  width: 100%;
  min-height: 200px;
  margin-bottom: 15px;
  border-radius: 8px;
  overflow: hidden;
  background: RGBA(var(--accentRGB), 0.05);
  border: var(--terminal-border);
  display: flex;
  justify-content: center;
  align-items: center;
}

.tool-preview {
  max-width: 100%;
  max-height: 400px;
  display: none;
}

.tool-preview.active {
  display: block;
}

.tool-placeholder {
  text-align: center;
  padding: 20px;
  color: var(--line-color);
}

.tool-placeholder svg {
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  color: var(--terminal-accent-color);
}

.tool-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 隐藏所有滚动条 */
::-webkit-scrollbar {
  display: none;
}

* {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/****************************************
 * 页眉样式
 *****************************************/
#boardHeader {
  position: relative;
  display: grid;
  grid-template-columns: 60% 40%;
  height: var(--headerHeight);
  margin-top: 20px;
}

#boardHeader .bannerInformation {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  background-color: var(--lighter);
  border-radius: 15px 0px 15px 15px;
  margin-right: -15px;
  margin-bottom: -20px;
  overflow: hidden;
  box-shadow: 0px 0px 50px -10px RGBA(000, 000, 000, 0.25);
}

#boardHeader .bannerInformation #headerWave1 {
  position: absolute;
  top: 0px;
  width: 100%;
  left: 0px;
  pointer-events: none;
}

#boardHeader .bannerInformation #headerWave2 {
  position: absolute;
  bottom: 0px;
  width: 100%;
  left: 0px;
  pointer-events: none;
}

/* 横幅标题样式 */
#boardHeader .bannerTitle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 15px;
}

#boardHeader .bannerTitle h1 {
  font: 500 60px/120% var(--fontBody);
  letter-spacing: -2px;
}

#boardHeader .bannerTitle h1 b {
  position: relative;
  font-weight: 800;
}

#boardHeader .bannerTitle h2 {
  font-weight: 800;
  font-size: 18px;
  color: RGBA(var(--darkerRGB), 0.75);
}

#boardHeader .bannerTitle h1 b:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 0px;
  left: 0px;
  display: block;
  height: 30%;
  width: 100%;
  background: var(--light);
  border-radius: 5px;
}

/* 横幅图片样式 */
#boardHeader .bannerImage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  background-image: var(--headerImage);
  width: 100%;
  height: calc(100% - 45px);
  max-height: var(--headerHeight);
  background-size: cover;
  border-radius: 0px 20px 20px 0px;
}

#boardHeader .bannerImage:before {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: -40px;
  left: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(84deg);
}

/* 管理员图片样式 */
#boardHeader .bannerStaff {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 0px 10px 10px;
  height: auto;
  background-color: var(--light);
  border-radius: 15px 0px 0px 15px;
}

#boardHeader .bannerStaff:before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -40px;
  right: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--light);
  transform: rotate(357deg);
}

#boardHeader .bannerStaff:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: -40px;
  right: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--light);
  transform: rotate(263deg);
}

#boardHeader .bannerStaff a.adminImage {
  display: block;
  width: 60px;
  height: 60px;
  background-color: var(--support);
  border-radius: 10px;
}

#boardHeader .bannerStaff img {
  display: block;
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
}

#boardHeader .bannerStaff a:hover img {
  transform: scale(1.1);
}

/****************************************
 * 中间内容区域样式
 *****************************************/
#boardCrotch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 15px;
  padding: 65px 30px 30px;
  width: calc(100% + 60px);
  background: var(--lighter);
  margin: -30px;
}

#boardCrotch:before {
  content: "";
  position: absolute;
  z-index: 0;
  top: -40px;
  left: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(84deg);
}

#boardCrotch:after {
  content: "";
  position: absolute;
  z-index: 0;
  top: -40px;
  right: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(350deg);
}

#boardCrotchBottom {
  position: relative;
  display: block;
  width: 100%;
}

#boardCrotchBottom:before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 15px;
  left: -30px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(165deg);
}

#boardCrotchBottom:after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 15px;
  right: -30px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(261deg);
}

section.siteArticle {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

section.siteIntroduction {
  background: RGBA(var(--lightRGB), 0.75);
  padding: 30px;
  border-radius: 20px;
}

nav.siteLinks {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
}

nav.siteLinks .navLinksContainer {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
}

nav.siteLinks .navTitle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font: 700 40px/100% var(--fontBody);
  letter-spacing: -1px;
}

span.navTitle > span:nth-child(1) {
  font-size: 45px;
}

span.navTitle span {
  position: relative;
  z-index: 1;
}

span.navTitle span.navTitleClass:after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 0px;
  left: 0px;
  display: block;
  height: 50%;
  width: 100%;
  background: var(--light);
  border-radius: 5px;
}

nav.siteLinks .navTitle i {
  color: var(--accent);
  font-size: 35px;
}

nav.siteLinks a {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  color: var(--dark);
  font-weight: 700;
  background-color: var(--accent);
  padding: 5px 10px 5px 35px;
  border-radius: 5px;
  overflow: hidden;
}

nav.siteLinks a:nth-child(2n + 1) {
  background-color: RGBA(var(--supportRGB), 1);
}

nav.siteLinks a i {
  position: absolute;
  left: -10px;
  font-size: 35px;
  font-weight: 100;
  color: var(--lighter);
}

nav.siteLinks a:hover i {
  transform: scale(1.4);
}

section.siteTime {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 15px;
  padding: 30px;
  width: 100%;
  height: 100%;
  color: var(--lightest);
  background-color: var(--accent);
  background-size: cover;
  background-position: center;
  background-blend-mode: hard-light;
  border-radius: 20px;
}

section.siteTime h1 {
  font: 800 30px/120% var(--fontBody);
  letter-spacing: -1px;
  text-shadow: 1px 2px 0px RGBA(var(--darkestRGB), 0.5);
}

section.siteTime h2 {
  position: absolute;
  bottom: 0px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: var(--lighter);
  padding: 10px 15px 0px;
  border-radius: 20px 20px 0px 0px;
  color: var(--dark);
}

section.siteTime h2 i {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 20px;
}

section.siteTime h2:before {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: 0px;
  right: -40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(76deg);
}

section.siteTime h2:after {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: 0px;
  left: -40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(4deg);
}

section.siteTime .siteTimeIcon {
  position: absolute;
  top: 0px;
  left: 0px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: var(--lighter);
  width: 50px;
  height: 50px;
  border-radius: 0px 0px 20px 0px;
}

section.siteTime .siteTimeIcon:before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0px;
  right: -40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(185deg);
}

section.siteTime .siteTimeIcon:after {
  content: "";
  position: absolute;
  z-index: 0;
  bottom: -39px;
  left: 0px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-shadow: 20px 20px 0 var(--lighter);
  transform: rotate(168deg);
}

section.siteTime .siteTimeIcon i {
  font-size: 25px;
  color: var(--accent);
}

section.siteTime:hover .siteTimeIcon i {
  transform: scale(1.3);
}

/****************************************
 * 内部内容容器样式
 *****************************************/
#contentWrapper {
  position: relative;
  width: 100%;
  padding: 30px;
}

/****************************************
 * 导航树样式
 *****************************************/
.siteNav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 20px;
  color: RGBA(var(--darkestRGB), 0.75);
  font: 600 14px/120% var(--fontBody);
  background: linear-gradient(
      45deg,
      RGBA(var(--accentRGB), 0.5) 0%,
      RGBA(var(--accentRGB), 0) 70%
    ),
    linear-gradient(
      135deg,
      RGBA(var(--supportRGB), 0.5) 10%,
      RGBA(var(--supportRGB), 0) 80%
    ),
    linear-gradient(
      225deg,
      RGBA(var(--featureRGB), 0.5) 10%,
      RGBA(var(--featureRGB), 0) 80%
    ),
    linear-gradient(
      315deg,
      RGBA(var(--supportRGB), 0.5) 100%,
      RGBA(var(--supportRGB), 0) 70%
    );
  padding: 10px;
  border-radius: 20px;
  backdrop-filter: blur(5px);
}

.siteNav a,
.siteNav label {
  color: var(--darkest);
}

.siteNav i {
  font-size: 20px;
  font-weight: 500;
  color: var(--lightest);
}

/* 每日一言 */
.siteIntroduction {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.quote-content {
  font-size: 18px;
  line-height: 1.6;
  margin-bottom: 10px;
}

.quote-from {
  font-size: 14px;
  color: var(--line-color);
  text-align: right;
  font-style: italic;
}

/* 底部信息*/
.siteNav {
  background: #799fb4;
  color: #333;
  padding: 10px;
  border-radius: 20px;
  backdrop-filter: none;
}

.status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 800px;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 25px;
  padding: 5px 0;
}

#fps-counter {
  font-family: var(--font-family);
  font-size: 13px;
  color: var(--dark);
  letter-spacing: 0.5px;
}

.weather-widget {
  display: flex;
  transition: all 0.3s ease;
}

.weather-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 5px;
}

.weather-location {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--dark);
}

.weather-location i {
  color: var(--accent);
  font-size: 12px;
}

.weather-temp {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
}

.weather-temp i {
  color: var(--feature);
}

.weather-details {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weather-condition {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--dark);
}

.weather-icon {
  color: var(--support);
  font-size: 12px;
}

.weather-stats {
  display: flex;
  gap: 12px;
}

.weather-stats span {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--dark);
}

.weather-stats i {
  font-size: 11px;
}

.weather-loading, 
.weather-error {
  font-size: 13px;
  padding: 5px 0;
  color: var(--dark);
}

/* 页脚链接样式 */
.siteNav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;  /* 水平居中 */
  align-items: center;     /* 垂直居中 */
  gap: 12px 20px;         /* 行间距12px,列间距20px */
  padding: 12px 0;
  font-size: 14px;
  color: var(--dark);
}

.footer-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 20px; /* 行间距10px,列间距20px */
  font-size: 14px;
  color: var(--dark);
  width: 100%; /* 确保占据全部宽度 */
  text-align: center; /* 文本居中 */
}

.footer-info a {
  color: var(--dark);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-info a:hover {
  color: var(--accent);
  text-decoration: underline;
}

#performance-info {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 响应式调整 - 在小屏幕上堆叠显示 */
@media (max-width: 600px) {
  .footer-info {
    flex-direction: column;
    gap: 5px;
  }
}

/* 加载动画 */
.loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(var(--accentRGB), 0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 图片懒加载 */
img[data-src] {
  opacity: 0;
  transition: opacity 0.3s;
}

img.lazyloaded {
  opacity: 1;
}

/* 访问性改进 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 打印样式 */
@media print {
  body * {
    visibility: hidden;
  }
  #printable, #printable * {
    visibility: visible;
  }
  #printable {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
  }
}

/* 代码格式化容器样式 */
.code-formatter-container {
  background: var(--editor-secondary-bg);
  border-radius: var(--border-radius);
  margin: 15px 0;
  border: var(--terminal-border);
  overflow: hidden;
  backdrop-filter: blur(5px);
  width: 100%;
  max-width: 100%;
}

.code-formatter-header {
  background: var(--header-bg);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: var(--terminal-border);
}

.code-formatter-title {
  color: var(--text-color);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-formatter-close {
  background: none;
  border: none;
  color: var(--line-color);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.code-formatter-content {
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
}

.code-formatter-textarea {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: var(--terminal-border);
  border-radius: 8px;
  background: var(--editor-bg);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  white-space: pre;
  overflow-x: auto;
}

.code-formatter-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.code-formatter-btn {
  background: var(--terminal-accent-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.code-formatter-btn:hover {
  background: var(--terminal-accent-hover);
  transform: translateY(-1px);
}

.code-type-selector {
  flex: 1;
  min-width: 120px;
  padding: 8px 12px;
  border: var(--terminal-border);
  border-radius: 6px;
  background: var(--editor-bg);
  color: var(--text-color);
  font-family: var(--fontBody);
  font-size: 12px;
  outline: none;
}

/****************************************
 * 媒体查询 - 响应式设计
 *****************************************/
@media screen and (max-width: 950px) {
  #boardWrapper {
    grid-template-columns: 1fr;
  }
  
  #boardSidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 60px;
    height: 100vh;
    z-index: 10000;
  }
  
  #innerWrapper {
    margin-left: 0;
  }
}

@media screen and (max-width: 860px) {
  #boardHeader {
    display: flex !important;
    flex-direction: column !important;
    gap: 40px;
    height: unset !important;
  }

  #boardHeader .bannerInformation {
    border-radius: 15px !important;
  }

  #boardHeader .bannerImage:before {
    top: 92px;
    left: -44px;
  }

  .bannerInformation {
    margin: 0px !important;
    padding: 200px 40px !important;
  }

  #boardHeader .bannerImage {
    background-image: unset !important;
    height: unset !important;
    margin-bottom: 30px !important;
  }

  #boardHeader .bannerStaff {
    display: flex;
    flex-direction: row;
    gap: 30px;
    padding: unset !important;
    background-color: unset !important;
    border-radius: unset !important;
  }

  #boardHeader .bannerStaff:after,
  #boardHeader .bannerStaff:before {
    display: none !important;
  }

  #boardCrotch {
    grid-template-columns: unset !important;
    grid-template-rows: auto 1fr !important;
    gap: 40px !important;
    margin-top: 0px !important;
  }

  section.siteArticle {
    z-index: 0;
    flex-direction: column-reverse !important;
    gap: 40px !important;
  }

  section.siteTime {
    zindex: 1;
    background-image: unset !important;
    padding-bottom: 60px;
  }
  
  /* 移动端调整终端位置 */
  #terminal-container {
    width: 95%;
    height: 85%;
    max-height: none;
  }
  
  /* 移动端调整终端菜单 */
  #linkmenu {
    padding: 20px;
  }
  
  /* 移动端调整视频播放器 */
  .video-container {
    margin-left: -15px;
    margin-right: -15px;
    border-radius: 0;
    width: calc(100% + 30px);
  }
  
  /* 移动端调整工具容器 */
  .tool-container {
    margin-left: -15px;
    margin-right: -15px;
    border-radius: 0;
    width: calc(100% + 30px);
  }
}

  </style>
</head>

<body class="act-idx code-00 group-4">
  <!-- 波浪背景SVG -->
  <svg id="headerWave" style="transform:rotate(180deg); transition: 0.3s" viewBox="0 0 1440 490" version="1.1" xmlns="http://www.w3.org/2000/svg">
    <defs>
      <linearGradient id="sw-gradient-0" x1="0" x2="0" y1="1" y2="0">
        <stop stop-color="var(--accent)" offset="0%"></stop>
        <stop stop-color="var(--support)" offset="50%"></stop>
        <stop stop-color="var(--feature)" offset="100%"></stop>
      </linearGradient>
    </defs>
    <path style="transform:translate(0, 0px); opacity:1" fill="url(#sw-gradient-0)" d="M0,294L80,253.2C160,212,320,131,480,155.2C640,180,800,310,960,334.8C1120,359,1280,278,1440,261.3C1600,245,1760,294,1920,294C2080,294,2240,245,2400,220.5C2560,196,2720,196,2880,187.8C3040,180,3200,163,3360,179.7C3520,196,3680,245,3840,277.7C4000,310,4160,327,4320,294C4480,261,4640,180,4800,147C4960,114,5120,131,5280,179.7C5440,229,5600,310,5760,351.2C5920,392,6080,392,6240,326.7C6400,261,6560,131,6720,65.3C6880,0,7040,0,7200,65.3C7360,131,7520,261,7680,334.8C7840,408,8000,425,8160,432.8C8320,441,8480,441,8640,400.2C8800,359,8960,278,9120,220.5C9280,163,9440,131,9600,171.5C9760,212,9920,327,10080,359.3C10240,392,10400,343,10560,310.3C10720,278,10880,261,11040,228.7C11200,196,11360,147,11440,122.5L11520,98L11520,490L11440,490C11360,490,11200,490,11040,490C10880,490,10720,490,10560,490C10400,490,10240,490,10080,490C9920,490,9760,490,9600,490C9440,490,9280,490,9120,490C8960,490,8800,490,8640,490C8480,490,8320,490,8160,490C8000,490,7840,490,7680,490C7520,490,7360,490,7200,490C7040,490,6880,490,6720,490C6560,490,6400,490,6240,490C6080,490,5920,490,5760,490C5600,490,5440,490,5280,490C5120,490,4960,490,4800,490C4640,490,4480,490,4320,490C4160,490,4000,490,3840,490C3680,490,3520,490,3360,490C3200,490,3040,490,2880,490C2720,490,2560,490,2400,490C2240,490,2080,490,1920,490C1760,490,1600,490,1440,490C1280,490,1120,490,960,490C800,490,640,490,480,490C320,490,160,490,80,490L0,490Z"></path>
  </svg>

  <!-- 主容器 -->
  <div id="boardWrapper">
    <!-- 侧边栏 -->
    <div id="boardSidebar">
      <div class="stickyBar">
        <div class="icons">
          <!-- 返回顶部按钮 -->
          <div onclick="scrollSmoothToTop()" title="返回顶部">
            <i class="ri-arrow-up-line"></i>
          </div>
          <!-- 主题切换开关 -->
          <label class="theme-switch" for="checkbox" id="theme_switch_click" title="切换主题">
            <input type="checkbox" id="checkbox">
            <dark><i class="ri-lightbulb-flash-line"></i></dark>
            <light><i class="ri-lightbulb-line"></i></light>
          </label>
          <!-- 滚动到底部按钮 -->
          <div onclick="scrollSmoothToBottom()" title="滚动到底部">
            <i class="ri-arrow-down-line"></i>
          </div>
          <!-- 终端按钮 -->
          <div onclick="usertoggle()" title="打开终端">
            <i class="ri-terminal-box-line"></i>
          </div>
        </div>
      </div>
    </div>

    <!-- 主内容区域 -->
    <div id="innerWrapper">
      <!-- 顶部栏背景 -->
      <div id="topbarBacking"></div>
      
      <!-- 顶部栏 -->
      <div id="boardTopbar">
        <div id="desktopTopbar">
          <!-- 会员链接 -->
          <div class="memberLinks">
            <button onclick="usertoggle()" class="memberAvatar">
              <img src='https://s9.gifyu.com/images/SZ1sL.png' alt='用户头像' />
            </button>
            <section class="memberInfo">
              <span><a href="#" target="_blank">藤原</a></span>
              <nav class="userLinks">
                <a href="mailto:2083737075@qq.com" class="noNewMessage" title="邮箱"><i class="ri-mail-line"></i></a>
                <a href="http://tengyuan.icu" class="noNewNotification" title="个人网站"><i class="ri-global-line"></i></a>
                <a href="http://blog.tengyuan.icu/" title="博客"><i class="ri-book-line"></i></a>
              </nav>
            </section>
          </div>
        </div>
      </div>

      <!-- 导航栏 -->
      <nav id="boardNavigation">
        <div id='navstrip' align='left'>
          <i class="ri-heart-line"></i>&nbsp;
          <a href='#'>TENG YUAN - 个人主页</a>
        </div>
      </nav>

      <!-- 用户切换菜单(终端) -->
      <div id="linkmenu-container">
        <div id="linkmenu">
          <!-- 终端容器 -->
          <div id="terminal-container">
            <!-- 终端编辑器 -->
            <div class="editor" id="mainEditor">
              <div class="editor-header">
                <span class="window-btn close" onclick="usertoggle()"></span>
                <span class="window-btn minimize"></span>
                <span class="window-btn maximize"></span>
                <span class="title-bar">terminal.js - 藤原的个人终端</span>
              </div>
              <div class="editor-content" id="editorContent">
                <div class="line"><div class="line-content"><span class="comment">// 个人信息配置</span></div></div>
                <div class="line"><div class="line-content"><span class="keyword">const</span> <span class="function">profile</span> = {</div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">name</span>: <span class="string">"藤原"</span>,</div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">title</span>: <span class="string">"职场牛马!!!"</span>,</div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">contact</span>: {</div></div>
                <div class="line"><div class="line-content indent-2"><span class="keyword">email</span>: <span class="string"><a href="mailto:2083737075@qq.com">"2083737075@qq.com"</a></span>,</div></div>
                <div class="line"><div class="line-content indent-2"><span class="keyword">website</span>: <span class="string"><a href="http://tengyuan.icu" target="_blank">"TengYuan.icu"</a></span>,</div></div>
                <div class="line"><div class="line-content indent-2"><span class="keyword">FileCodeBox</span>: <span class="string"><a href="http://wp.tengyuan.icu/" target="_blank">"wp.tengyuan.icu"</a></span>,</div></div>
                <div class="line"><div class="line-content indent">},</div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">links</span>: {</div></div>
                <div class="line"><div class="line-content indent-2"><span class="keyword">travel blog</span>: <span class="string"><a href="http://blog.tengyuan.icu/" target="_blank">"blog.tengyuan.icu"</a></span>,</div></div>
                <div class="line"><div class="line-content indent-2"><span class="keyword">birthday</span>: <span class="string"><a href="http://sr.0814.cn" target="_blank">"2001/11/01"</a></span>,</div></div>
                <div class="line"><div class="line-content indent">},</div></div>
                <div class="line"><div class="line-content indent"><span class="comment">// 座右铭</span></div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">motto</span>: <span class="string">"以清简代码,筑玖维数字宇宙。"</span>,</div></div>
                <div class="line"><div class="line-content indent"><span class="keyword">copyright</span>: <span class="string">"2017-<span id="year"></span> 藤原"</span>,</div></div>
                <div class="line"><div class="line-content">};</div></div>
                
                <div class="line"><div class="line-content"><span class="comment">// 终端交互</span></div></div>
                <div class="line"><div class="line-content"><span class="function">console</span>.<span class="function">log</span>(<span class="string">"欢迎访问藤原的个人终端"</span>);</div></div>
                <div class="line"><div class="line-content"><span class="function">console</span>.<span class="function">log</span>(<span class="string">"输入 'help' 获取可用命令"</span>);</div></div>
              </div>
              
              <!-- 输入行 -->
              <div class="input-line">
                <input type="text" id="userInput" placeholder="输入命令..." autocomplete="off">
              </div>
            </div>
          </div>
        </div>
      </div>

      <!-- 页眉部分 -->
      <header id="boardHeader">
        <content class="bannerInformation">
          <svg id="headerWave1" style="transform:rotate(180deg); transition: 0.3s" viewBox="0 0 1440 490" version="1.1" xmlns="http://www.w3.org/2000/svg">
            <defs>
              <linearGradient id="sw-gradient-header1" x1="0" x2="0" y1="1" y2="0">
                <stop stop-color="var(--accent)" offset="0%"></stop>
                <stop stop-color="var(--support)" offset="50%"></stop>
                <stop stop-color="var(--feature)" offset="100%"></stop>
              </linearGradient>
            </defs>
            <path style="transform:translate(0, 0px); opacity:1" fill="url(#sw-gradient-header1)" d="M0,343L80,359.3C160,376,320,408,480,367.5C640,327,800,212,960,212.3C1120,212,1280,327,1440,383.8C1600,441,1760,441,1920,383.8C2080,327,2240,212,2400,171.5C2560,131,2720,163,2880,147C3040,131,3200,65,3360,98C3520,131,3680,261,3840,318.5C4000,376,4160,359,4320,318.5C4480,278,4640,212,4800,163.3C4960,114,5120,82,5280,89.8C5440,98,5600,147,5760,163.3C5920,180,6080,163,6240,138.8C6400,114,6560,82,6720,106.2C6880,131,7040,212,7200,253.2C7360,294,7520,294,7680,261.3C7840,229,8000,163,8160,147C8320,131,8480,163,8640,171.5C8800,180,8960,163,9120,138.8C9280,114,9440,82,9600,89.8C9760,98,9920,147,10080,163.3C10240,180,10400,163,10560,147C10720,131,10880,114,11040,89.8C11200,65,11360,33,11440,16.3L11520,0L11520,490L11440,490C11360,490,11200,490,11040,490C10880,490,10720,490,10560,490C10400,490,10240,490,10080,490C9920,490,9760,490,9600,490C9440,490,9280,490,9120,490C8960,490,8800,490,8640,490C8480,490,8320,490,8160,490C8000,490,7840,490,7680,490C7520,490,7360,490,7200,490C7040,490,6880,490,6720,490C6560,490,6400,490,6240,490C6080,490,5920,490,5760,490C5600,490,5440,490,5280,490C5120,490,4960,490,4800,490C4640,490,4480,490,4320,490C4160,490,4000,490,3840,490C3680,490,3520,490,3360,490C3200,490,3040,490,2880,490C2720,490,2560,490,2400,490C2240,490,2080,490,1920,490C1760,490,1600,490,1440,490C1280,490,1120,490,960,490C800,490,640,490,480,490C320,490,160,490,80,490L0,490Z"></path>
          </svg>

          <div class="bannerTitle">
            <h1>Life is a wilderness!<b> Mom</b>.</h1>
            <h2>TENG YUAN</h2>
          </div>

          <svg id="headerWave2" style="transform:rotate(0deg); transition: 0.3s" viewBox="0 0 1440 490" version="1.1" xmlns="http://www.w3.org/2000/svg">
            <defs>
              <linearGradient id="sw-gradient-header2" x1="0" x2="0" y1="1" y2="0">
                <stop stop-color="var(--accent)" offset="0%"></stop>
                <stop stop-color="var(--support)" offset="100%"></stop>
              </linearGradient>
            </defs>
            <path style="transform:translate(0, 0px); opacity:1" fill="url(#sw-gradient-header2)" d="M0,98L80,147C160,196,320,294,480,334.8C640,376,800,359,960,318.5C1120,278,1280,212,1440,187.8C1600,163,1760,180,1920,196C2080,212,2240,229,2400,204.2C2560,180,2720,114,2880,147C3040,180,3200,310,3360,326.7C3520,343,3680,245,3840,220.5C4000,196,4160,245,4320,220.5C4480,196,4640,98,4800,98C4960,98,5120,196,5280,204.2C5440,212,5600,131,5760,130.7C5920,131,6080,212,6240,212.3C6400,212,6560,131,6720,122.5C6880,114,7040,180,7200,187.8C7360,196,7520,147,7680,179.7C7840,212,8000,327,8160,383.8C8320,441,8480,441,8640,392C8800,343,8960,245,9120,171.5C9280,98,9440,49,9600,49C9760,49,9920,98,10080,130.7C10240,163,10400,180,10560,155.2C10720,131,10880,65,11040,65.3C11200,65,11360,131,11440,163.3L11520,196L11520,490L11440,490C11360,490,11200,490,11040,490C10880,490,10720,490,10560,490C10400,490,10240,490,10080,490C9920,490,9760,490,9600,490C9440,490,9280,490,9120,490C8960,490,8800,490,8640,490C8480,490,8320,490,8160,490C8000,490,7840,490,7680,490C7520,490,7360,490,7200,490C7040,490,6880,490,6720,490C6560,490,6400,490,6240,490C6080,490,5920,490,5760,490C5600,490,5440,490,5280,490C5120,490,4960,490,4800,490C4640,490,4480,490,4320,490C4160,490,4000,490,3840,490C3680,490,3520,490,3360,490C3200,490,3040,490,2880,490C2720,490,2560,490,2400,490C2240,490,2080,490,1920,490C1760,490,1600,490,1440,490C1280,490,1120,490,960,490C800,490,640,490,480,490C320,490,160,490,80,490L0,490Z"></path>
          </svg>
        </content>
        <aside class="bannerImage">
          <div class="bannerStaff">
            <!-- 管理员图片部分 -->
            <a href="#" class="adminImage"><img src="https://s9.gifyu.com/images/SZ1sL.png" alt="管理员头像"></a>
            <a href="#" class="adminImage"><img src="https://s9.gifyu.com/images/SZ1sL.png" alt="管理员头像"></a>
            <a href="#" class="adminImage"><img src="https://s9.gifyu.com/images/SZ1sL.png" alt="管理员头像"></a>
            <a href="#" class="adminImage"><img src="https://s9.gifyu.com/images/SZ1sL.png" alt="管理员头像"></a>
          </div>
        </aside>
      </header>

      <!-- 中间内容区域 -->
      <div id="boardCrotch">
        <section class="siteTime" style="background-image: var(--settingImage);">
          <div class="siteTimeIcon"><i class="ri-map-pin-user-fill"></i></div>
          <h1>虚构的城市</h1>
          <h2><i class="ri-sun-foggy-line"></i> 2025年夏季</h2>
        </section>
        <section class="siteArticle">
          <nav class="siteLinks">
            <span class="navLinksContainer">
              <a href="https://weixin.qq.com/"> <i class="ri-wechat-line"></i> 微信 </a>
              <a href="https://im.qq.com/"> <i class="ri-qq-line"></i> QQ </a>
              <a href="https://www.zhihu.com/"> <i class="ri-zhihu-line"></i> 知乎 </a>
              <a href="https://www.bilibili.com/"> <i class="ri-bilibili-line"></i> 哔哩哔哩 </a>
              <a href="/"> <i class="ri-firebase-line"></i> guidebook </a>
              <a href="/"> <i class="ri-book-marked-line"></i> premise </a>
              <a href="/"> <i class="ri-building-line"></i> setting </a>
              <a href="/"> <i class="ri-pie-chart-line"></i> member groups </a>
              <a href="/"> <i class="ri-file-user-line"></i> directory </a>
              <a href="/"> <i class="ri-team-line"></i> face claims </a>
              <a href="/"> <i class="ri-user-search-line"></i> classifieds </a>
              <a href="/"> <i class="ri-code-box-line"></i> codes </a>
              <a href="/"> <i class="ri-discord-line"></i> discord </a>
            </span>
            <span class="navTitle">
              <span>quick</span>
              <span class="navTitleClass"><i class="ri-arrow-go-back-line"></i> nav</span>
            </span>
          </nav>

          <section class="siteIntroduction" id="daily-quote">
            <div class="quote-content">加载中...</div>
            <div class="quote-from"></div>
          </section>
        </section>
      </div>
      <div id="boardCrotchBottom"></div>

      <!-- 内部内容容器 -->
      <div id="contentWrapper">
        <!-- 导航树样式 -->
        <nav class="siteNav">
          <i class="ri-hearts-line"></i>
          <!-- 页脚信息行 -->
          <div class="footer-info">
            <span>© 2025 藤原 All Rights Reserved</span>
            <a href="https://beian.miit.gov.cn/" target="_blank">ICP备案号: 闽ICP备2025097315号-2</a>
            <span id="performance-info"></span>
          </div>
        </nav>
      </div>
    </div>
  </div>

  <!-- 隐藏的文件输入元素 -->
  <input type="file" id="fileInput" accept="image/*" style="display: none;">
  
  <!-- 背景音乐 -->
  <audio id="bgMusic" loop>
    <source src="music/1.mp3" type="audio/mpeg">
    您的浏览器不支持音频元素。
  </audio>
  
  <!-- 音乐播放器 -->
  <script id="xplayer" src="https://y.cenguigui.cn/Static/player12/js/player.js" key="68613b9a36853" api="https://y.cenguigui.cn/">    
<!-- JavaScript代码 -->
<script>
// ================ 全局变量 ================
// 统一API配置
const API_CONFIG = {
    id: '10003788',
    key: 'ffa8afb46dce4916c5a74fd73c8de9f6',
    endpoints: {
        ai: 'https://cn.apihz.cn/api/ai/wxtiny.php',
        ping: 'https://cn.apihz.cn/api/wangzhan/ping.php',
        shortVideo: 'http://124.220.49.230/api/fun/douyin.php'
    }
};

let commandHistoryArray = JSON.parse(localStorage.getItem('commandHistory') || '[]');
let historyIndex = -1;
let totalParseCount = parseInt(localStorage.getItem('totalParseCount') || '0');
let successParseCount = parseInt(localStorage.getItem('successParseCount') || '0');
let indentSize = 4; // 默认缩进4个空格

// 设置当前年份
document.getElementById('year').textContent = new Date().getFullYear();

// 更新解析统计
function updateParseStats() {
    localStorage.setItem('totalParseCount', totalParseCount.toString());
    localStorage.setItem('successParseCount', successParseCount.toString());
}

// 初始化统计
updateParseStats();

// ================ 终端功能 ================
const editorContent = document.getElementById('editorContent');
const userInput = document.getElementById('userInput');
const fileInput = document.getElementById('fileInput');

// 支持的视频平台列表
const supportedVideoPlatforms = [
    'v.qq.com',     // 腾讯视频
    'iqiyi.com',    // 爱奇艺
    'youku.com',    // 优酷
    'mgtv.com',     // 芒果TV
    'bilibili.com', // 哔哩哔哩
    'sohu.com',     // 搜狐视频
    'le.com',       // 乐视视频
    'pptv.com',     // PPTV
    'wasu.cn',      // 华数TV
    '1905.com',     // 电影网
    'fun.tv',       // 风行网
    'acfun.cn',     // AcFun
    'douyu.com',    // 斗鱼直播
    'huya.com',     // 虎牙直播
    'yy.com'        // YY直播
];

// 检查URL是否属于支持的视频平台
function isSupportedVideoUrl(url) {
    if (!url) return false;
    
    try {
        const domain = new URL(url).hostname.toLowerCase();
        return supportedVideoPlatforms.some(platform => domain.includes(platform));
    } catch (e) {
        return false;
    }
}

// 影视解析接口
const videoApis = [
    { name: "默认线路【推荐】", url: "https://www.yemu.xyz/?url=" },
    { name: "线路一【推荐】", url: "https://jx.we-vip.com/?url=" },
    { name: "线路二【推荐】", url: "https://z1.m1907.top/?jx=" },
    { name: "线路三", url: "https://www.ckplayer.vip/jiexi/?url=" },
    { name: "线路五", url: "https://jx.jsonplayer.com/player/?url=" },
    { name: "线路六", url: "https://jx.4kdv.com/?url=" },
    { name: "线路七", url: "https://api.jiexi.la/?url=" },
    { name: "线路八", url: "https://jx.qqwtt.com/?url=" },
    { name: "线路九", url: "https://www.playm3u8.cn/jiexi.php?url=" },
    { name: "线路十", url: "https://jx.xmflv.com/?url=" }
];

// 优化后的帮助信息
const helpText = `
可用命令:

基础命令:
- help: 显示帮助信息
- clear: 清空终端
- history: 显示命令历史记录

代码工具:
- format [code]: 格式化代码 (支持: sql, json, html, css, js)
  例如: format {"name":"John","age":30}
- minify [code]: 压缩代码 (支持: sql, json, html, css, js)
  例如: minify <div><p>Hello</p></div>
- detect [code]: 自动检测代码类型
  例如: detect SELECT * FROM users

设置:
- set indent [size]: 设置缩进大小 (1-8个空格)
  例如: set indent 4

影视工具:
- shortvideo [url]: 解析短视频(支持抖音、快手、小红书)
  例如: shortvideo https://v.douyin.com/xxxxxx

网络工具:
- ping [url]: 测试网站或IP的ping延迟
  例如: ping www.example.com

AI工具:
- ai [message]: 与AI助手对话
  例如: ai 你好

图片工具:
- image [format]: 转换图片格式 (支持: jpg, png, webp, bmp)
  例如: image png

其他工具:
- stats: 显示系统统计信息
`;

// 代码格式化工具函数 - 修复版本
function formatCode(code, type) {
    try {
        // 移除首尾空白
        code = code.trim();
        
        // 根据不同类型进行格式化
        switch(type.toLowerCase()) {
            case 'json':
                try {
                    const parsed = JSON.parse(code);
                    return JSON.stringify(parsed, null, ' '.repeat(indentSize));
                } catch (e) {
                    throw new Error(`JSON解析错误: ${e.message}`);
                }
                
            case 'html':
                // 使用更可靠的HTML格式化方法
                let html = code;
                let formatted = '';
                let indent = 0;
                let inTag = false;
                let inAttribute = false;
                let currentLine = '';
                
                // 添加换行和缩进
                for (let i = 0; i < html.length; i++) {
                    const char = html[i];
                    const nextChar = html[i+1];
                    
                    if (char === '<' && nextChar === '/') {
                        // 结束标签
                        indent = Math.max(0, indent - 1); // 确保indent不小于0
                        if (currentLine.trim()) {
                            formatted += ' '.repeat(indent * indentSize) + currentLine + '\n';
                            currentLine = '';
                        }
                        currentLine += char;
                    } else if (char === '<') {
                        // 开始标签
                        if (currentLine.trim()) {
                            formatted += ' '.repeat(indent * indentSize) + currentLine + '\n';
                            currentLine = '';
                        }
                        currentLine += char;
                        if (nextChar !== '!' && nextChar !== '?') {
                            indent++;
                        }
                    } else if (char === '>') {
                        // 标签结束
                        currentLine += char;
                        formatted += ' '.repeat(Math.max(0, indent - 1) * indentSize) + currentLine + '\n';
                        currentLine = '';
                    } else {
                        currentLine += char;
                    }
                }
                
                return formatted.trim();
                
            case 'js':
                // 更完善的JS格式化
                let js = code;
                let jsIndent = 0;
                let jsResult = '';
                let inString = false;
                let stringChar = '';
                
                // 处理基础缩进
                js = js.replace(/([{}\[\]])/g, '\n$1\n')
                      .replace(/([;,])\s*/g, '$1\n')
                      .replace(/\n+/g, '\n');
                
                const lines = js.split('\n');
                for (const line of lines) {
                    const trimmed = line.trim();
                    
                    if (!trimmed) continue;
                    
                    // 处理字符串中的内容
                    if (inString) {
                        jsResult += trimmed;
                        if (trimmed.endsWith(stringChar)) {
                            inString = false;
                            stringChar = '';
                        }
                        continue;
                    }
                    
                    if (trimmed.startsWith('"') || trimmed.startsWith("'")) {
                        inString = true;
                        stringChar = trimmed[0];
                    }
                    
                    if (trimmed.endsWith('}') || trimmed.endsWith(']')) {
                        jsIndent--;
                    }
                    
                    jsResult += ' '.repeat(jsIndent * indentSize) + trimmed + '\n';
                    
                    if (trimmed.endsWith('{') || trimmed.endsWith('[')) {
                        jsIndent++;
                    }
                }
                
                return jsResult.trim();
                
            default:
                return code;
        }
    } catch (e) {
        return `格式化错误: ${e.message}`;
    }
}

// 代码压缩工具函数
function minifyCode(code, type) {
    try {
        code = code.trim();
        
        switch(type.toLowerCase()) {
            case 'json':
                try {
                    const parsed = JSON.parse(code);
                    return JSON.stringify(parsed);
                } catch (e) {
                    throw new Error(`JSON解析错误: ${e.message}`);
                }
                
            case 'html':
                // 简单HTML压缩
                return code.replace(/\s+/g, ' ')
                          .replace(/<!--[\s\S]*?-->/g, '')
                          .replace(/>\s+</g, '><')
                          .trim();
                
            case 'css':
                // CSS压缩
                return code.replace(/\/\*[\s\S]*?\*\//g, '')  // 移除注释
                          .replace(/\s+/g, ' ')               // 压缩空格
                          .replace(/\s*([{};:,])\s*/g, '$1')  // 移除符号周围的空格
                          .replace(/;}/g, '}')                // 移除最后一个分号
                          .trim();
                
            case 'js':
                // 简单JS压缩
                return code.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, '')  // 移除注释
                          .replace(/\s+/g, ' ')                      // 压缩空格
                          .replace(/\s*([=+\-*\/%&|^~!<>?:;,{}()[\]])\s*/g, '$1')  // 移除操作符周围的空格
                          .replace(/;}/g, '}')                       // 移除最后一个分号
                          .trim();
                
            default:
                return code;
        }
    } catch (e) {
        return `压缩错误: ${e.message}`;
    }
}

// 检测代码类型函数增强版
function detectCodeType(code) {
    code = code.trim();
    
    // 尝试解析为JSON
    try {
        JSON.parse(code);
        return 'json';
    } catch (e) {}
    
    // 检查HTML
    if (code.startsWith('<') || code.match(/<[a-z][\s\S]*>/i)) {
        return 'html';
    }
    
    // 检查CSS
    if (code.match(/(^|\}|\{)[^{}]*\{[^{}]*\}/) || 
       code.match(/\.([a-z][\w-]*)\s*\{|\#([a-z][\w-]*)\s*\{|@(media|keyframes|import)/i)) {
        return 'css';
    }
    
    // 检查SQL
    if (code.match(/\b(SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|DROP|FROM|WHERE|JOIN)\b/i)) {
        return 'sql';
    }
    
    // 检查JS
    if (code.match(/function\s*\(|=>|\b(let|const|var)\s+\w+\s*=|console\.log|import\s+|export\s+/)) {
        return 'js';
    }
    
    return 'text';
}

// 创建代码格式化器容器 - 修复版本
function createCodeFormatter(initialCode = '', initialType = 'auto', operation = 'format') {
    // 移除现有的格式化器
    const existingFormatter = document.querySelector('.code-formatter-container');
    if (existingFormatter) {
        existingFormatter.remove();
        return;
    }
    
    const formatter = document.createElement('div');
    formatter.className = 'code-formatter-container';
    
    // 头部
    const header = document.createElement('div');
    header.className = 'code-formatter-header';
    
    const title = document.createElement('div');
    title.className = 'code-formatter-title';
    title.innerHTML = `
        <i class="ri-code-line"></i>
        ${operation === 'format' ? '代码格式化工具' : '代码压缩工具'}
    `;
    
    const closeBtn = document.createElement('button');
    closeBtn.className = 'code-formatter-close';
    closeBtn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
    closeBtn.addEventListener('click', () => formatter.remove());
    
    header.appendChild(title);
    header.appendChild(closeBtn);
    
    // 内容区域
    const content = document.createElement('div');
    content.className = 'code-formatter-content';
    
    // 代码类型选择器
    const typeSelector = document.createElement('select');
    typeSelector.className = 'code-type-selector';
    typeSelector.innerHTML = `
        <option value="auto" ${initialType === 'auto' ? 'selected' : ''}>自动检测</option>
        <option value="json" ${initialType === 'json' ? 'selected' : ''}>JSON</option>
        <option value="html" ${initialType === 'html' ? 'selected' : ''}>HTML</option>
        <option value="css" ${initialType === 'css' ? 'selected' : ''}>CSS</option>
        <option value="js" ${initialType === 'js' ? 'selected' : ''}>JavaScript</option>
        <option value="sql" ${initialType === 'sql' ? 'selected' : ''}>SQL</option>
    `;
    
    // 创建双面板布局
    const panelContainer = document.createElement('div');
    panelContainer.style.cssText = `
        display: flex;
        gap: 15px;
        margin-bottom: 15px;
    `;
    
    // 输入面板
    const inputPanel = document.createElement('div');
    inputPanel.style.cssText = `
        flex: 1;
        display: flex;
        flex-direction: column;
    `;
    
    const inputLabel = document.createElement('div');
    inputLabel.style.cssText = `
        font-size: 12px;
        color: var(--line-color);
        margin-bottom: 5px;
    `;
    inputLabel.textContent = '输入代码';
    
    const inputTextarea = document.createElement('textarea');
    inputTextarea.className = 'code-formatter-textarea';
    inputTextarea.style.cssText = `
        flex: 1;
        min-height: 200px;
    `;
    inputTextarea.value = initialCode;
    
    inputPanel.appendChild(inputLabel);
    inputPanel.appendChild(inputTextarea);
    
    // 输出面板
    const outputPanel = document.createElement('div');
    outputPanel.style.cssText = `
        flex: 1;
        display: flex;
        flex-direction: column;
    `;
    
    const outputLabel = document.createElement('div');
    outputLabel.style.cssText = `
        font-size: 12px;
        color: var(--line-color);
        margin-bottom: 5px;
    `;
    outputLabel.textContent = '输出结果';
    
    const outputTextarea = document.createElement('textarea');
    outputTextarea.className = 'code-formatter-textarea';
    outputTextarea.style.cssText = `
        flex: 1;
        min-height: 200px;
        background: rgba(var(--accentRGB), 0.05);
    `;
    outputTextarea.readOnly = true;
    
    outputPanel.appendChild(outputLabel);
    outputPanel.appendChild(outputTextarea);
    
    panelContainer.appendChild(inputPanel);
    panelContainer.appendChild(outputPanel);
    
    // 操作按钮
    const actions = document.createElement('div');
    actions.className = 'code-formatter-actions';
    
    const processBtn = document.createElement('button');
    processBtn.className = 'code-formatter-btn';
    processBtn.innerHTML = `
        <i class="ri-${operation === 'format' ? 'indent-increase' : 'indent-decrease'}"></i>
        ${operation === 'format' ? '格式化代码' : '压缩代码'}
    `;
    
    const copyBtn = document.createElement('button');
    copyBtn.className = 'code-formatter-btn';
    copyBtn.innerHTML = `
        <i class="ri-clipboard-line"></i>
        复制结果
    `;
    
    const detectBtn = document.createElement('button');
    detectBtn.className = 'code-formatter-btn';
    detectBtn.innerHTML = `
        <i class="ri-search-line"></i>
        检测类型
    `;
    
    // 处理按钮点击事件
    processBtn.addEventListener('click', () => {
        const code = inputTextarea.value;
        const type = typeSelector.value === 'auto' ? detectCodeType(code) : typeSelector.value;
        
        try {
            const processed = operation === 'format' 
                ? formatCode(code, type) 
                : minifyCode(code, type);
            
            outputTextarea.value = processed;
            
            // 显示成功消息
            const message = document.createElement('div');
            message.style.cssText = `
                color: var(--success-color);
                font-size: 12px;
                margin-top: 10px;
                text-align: center;
            `;
            message.textContent = `${operation === 'format' ? '格式化' : '压缩'}成功 (类型: ${type})`;
            
            // 移除旧的消息
            const oldMessage = actions.querySelector('.formatter-message');
            if (oldMessage) oldMessage.remove();
            
            message.className = 'formatter-message';
            actions.appendChild(message);
            
            // 3秒后自动消失
            setTimeout(() => {
                if (message.parentNode) {
                    message.style.opacity = '0';
                    setTimeout(() => message.remove(), 300);
                }
            }, 3000);
        } catch (error) {
            // 显示错误消息
            const errorMsg = document.createElement('div');
            errorMsg.style.cssText = `
                color: var(--error-color);
                font-size: 12px;
                margin-top: 10px;
                text-align: center;
            `;
            errorMsg.textContent = `${operation === 'format' ? '格式化' : '压缩'}失败: ${error.message}`;
            
            // 移除旧的消息
            const oldMessage = actions.querySelector('.formatter-message');
            if (oldMessage) oldMessage.remove();
            
            errorMsg.className = 'formatter-message';
            actions.appendChild(errorMsg);
        }
    });
    
    // 复制按钮点击事件
    copyBtn.addEventListener('click', () => {
        outputTextarea.select();
        document.execCommand('copy');
        
        // 显示复制成功消息
        const message = document.createElement('div');
        message.style.cssText = `
            color: var(--success-color);
            font-size: 12px;
            margin-top: 10px;
            text-align: center;
        `;
        message.textContent = '代码已复制到剪贴板';
        
        // 移除旧的消息
        const oldMessage = actions.querySelector('.formatter-message');
        if (oldMessage) oldMessage.remove();
        
        message.className = 'formatter-message';
        actions.appendChild(message);
        
        // 3秒后自动消失
        setTimeout(() => {
            if (message.parentNode) {
                message.style.opacity = '0';
                setTimeout(() => message.remove(), 300);
            }
        }, 3000);
    });
    
    // 检测按钮点击事件
    detectBtn.addEventListener('click', () => {
        const code = inputTextarea.value;
        const type = detectCodeType(code);
        
        // 显示检测结果
        const message = document.createElement('div');
        message.style.cssText = `
            color: var(--terminal-accent-color);
            font-size: 12px;
            margin-top: 10px;
            text-align: center;
        `;
        message.textContent = `检测到的代码类型: ${type}`;
        
        // 移除旧的消息
        const oldMessage = actions.querySelector('.formatter-message');
        if (oldMessage) oldMessage.remove();
        
        message.className = 'formatter-message';
        actions.appendChild(message);
        
        // 自动选择检测到的类型
        if (type !== 'text' && typeSelector.querySelector(`option[value="${type}"]`)) {
            typeSelector.value = type;
        }
        
        // 3秒后自动消失
        setTimeout(() => {
            if (message.parentNode) {
                message.style.opacity = '0';
                setTimeout(() => message.remove(), 300);
            }
        }, 3000);
    });
    
    actions.appendChild(typeSelector);
    actions.appendChild(processBtn);
    actions.appendChild(copyBtn);
    actions.appendChild(detectBtn);
    
    content.appendChild(panelContainer);
    content.appendChild(actions);
    formatter.appendChild(header);
    formatter.appendChild(content);
    
    // 添加到编辑器内容区
    editorContent.appendChild(formatter);
    editorContent.scrollTop = editorContent.scrollHeight;
    
    // 自动聚焦到输入文本区域
    inputTextarea.focus();
    
    // 如果初始代码不为空,自动处理
    if (initialCode.trim()) {
        processBtn.click();
    }
}

// 打字机效果函数
function typeWriterEffect(element, text, speed = 10) {
    return new Promise((resolve) => {
        let i = 0;
        const typing = () => {
            if (i < text.length) {
                element.textContent += text.charAt(i);
                i++;
                setTimeout(typing, speed);
            } else {
                resolve();
            }
        };
        typing();
    });
}

async function addAILine(text) {
    const line = document.createElement('div');
    line.className = 'line';
    
    const lineContent = document.createElement('div');
    lineContent.className = 'line-content ai-output';
    lineContent.textContent = '藤原: ';
    
    line.appendChild(lineContent);
    editorContent.appendChild(line);
    editorContent.scrollTop = editorContent.scrollHeight;
    
    await typeWriterEffect(lineContent, text);
    return line;
}

function addUserLine(text) {
    const line = document.createElement('div');
    line.className = 'line';
    
    const lineContent = document.createElement('div');
    lineContent.className = 'line-content user-input';
    lineContent.textContent = `> ${text}`;
    
    line.appendChild(lineContent);
    editorContent.appendChild(line);
    editorContent.scrollTop = editorContent.scrollHeight;
    return line;
}

function clearTerminal() {
    const lines = document.querySelectorAll('.line');
    
    lines.forEach(line => {
        const content = line.querySelector('.line-content').textContent;
        if (!content.includes('// 个人信息配置') &&
            !content.includes('const profile') &&
            !content.includes('name:') &&
            !content.includes('title:') &&
            !content.includes('contact:') &&
            !content.includes('email:') &&
            !content.includes('website:') &&
            !content.includes('FileCodeBox:') &&
            !content.includes('links:') &&
            !content.includes('travel blog:') &&
            !content.includes('birthday:') &&
            !content.includes('motto:') &&
            !content.includes('copyright:') &&
            !content.includes('};') &&
            !content.includes('// 终端交互') &&
            !content.includes('console.log')) {
            line.remove();
        }
    });
    
    // 移除视频、图片等组件
    const videoContainer = document.querySelector('.video-container');
    const imageConverter = document.querySelector('.tool-container');
    const shortVideoParser = document.querySelector('.tool-container');
    const searchResults = document.querySelector('.search-results');
    const codeFormatter = document.querySelector('.code-formatter-container');
    if (videoContainer) videoContainer.remove();
    if (imageConverter) imageConverter.remove();
    if (shortVideoParser) shortVideoParser.remove();
    if (searchResults) searchResults.remove();
    if (codeFormatter) codeFormatter.remove();
}

// ============== 影视解析功能 ==============
function parseVideo(url) {
    // 检查URL是否属于支持的视频平台
    if (!isSupportedVideoUrl(url)) {
        addAILine('藤原: 不支持该视频平台的解析,目前支持以下平台:');
        addAILine('腾讯视频、爱奇艺、优酷、芒果TV、哔哩哔哩等');
        return;
    }

    // 移除现有的播放器
    const existingPlayer = document.querySelector('.video-container');
    if (existingPlayer) {
        existingPlayer.remove();
    }

    // 增加解析次数统计
    totalParseCount++;
    updateParseStats();

    // 显示加载状态
    const loadingLine = document.createElement('div');
    loadingLine.className = 'line';
    const loadingContent = document.createElement('div');
    loadingContent.className = 'line-content ai-output';
    loadingContent.textContent = '藤原: 正在解析视频,请稍候...';
    loadingLine.appendChild(loadingContent);
    editorContent.appendChild(loadingLine);
    editorContent.scrollTop = editorContent.scrollHeight;

    // 创建视频播放器容器
    const videoContainer = document.createElement('div');
    videoContainer.className = 'video-container';
    
    // 创建视频元素
    const videoPlayer = document.createElement('div');
    videoPlayer.className = 'video-player';
    
    // 使用iframe来播放解析后的视频
    const videoElement = document.createElement('iframe');
    videoElement.id = 'terminal-video';
    
    // 使用默认解析线路
    const defaultApi = videoApis[0];
    videoElement.src = defaultApi.url + encodeURIComponent(url);
    
    videoElement.frameBorder = '0';
    videoElement.allowFullscreen = true;
    videoElement.style.width = '100%';
    videoElement.style.height = '100%';
    
    videoPlayer.appendChild(videoElement);
    
    // 视频控制区域
    const videoControls = document.createElement('div');
    videoControls.className = 'video-controls';
    
    // 当前线路显示
    const currentLine = document.createElement('span');
    currentLine.style.cssText = 'color: var(--line-color); font-size: 12px; margin-right: 10px;';
    currentLine.textContent = `当前线路: ${defaultApi.name}`;
    
    // 刷新按钮
    const refreshButton = document.createElement('button');
    refreshButton.className = 'video-button';
    refreshButton.textContent = '刷新';
    refreshButton.addEventListener('click', () => {
        videoElement.src = videoElement.src;
    });
    
    // 线路切换按钮
    const switchButton = document.createElement('button');
    switchButton.className = 'video-button';
    switchButton.textContent = '切换线路';
    switchButton.addEventListener('click', () => {
        showVideoApiSelector(url);
    });
    
    // 全屏按钮
    const fullscreenButton = document.createElement('button');
    fullscreenButton.className = 'video-button';
    fullscreenButton.textContent = '全屏';
    fullscreenButton.addEventListener('click', () => {
        if (videoElement.requestFullscreen) {
            videoElement.requestFullscreen();
        }
    });
    
    // 关闭按钮
    const closeButton = document.createElement('button');
    closeButton.className = 'video-button';
    closeButton.textContent = '关闭';
    closeButton.addEventListener('click', () => videoContainer.remove());
    
    videoControls.appendChild(currentLine);
    videoControls.appendChild(refreshButton);
    videoControls.appendChild(switchButton);
    videoControls.appendChild(fullscreenButton);
    videoControls.appendChild(closeButton);
    
    // 组装整个播放器
    videoContainer.appendChild(videoPlayer);
    videoContainer.appendChild(videoControls);
    
    // 添加到编辑器内容区
    editorContent.appendChild(videoContainer);
    editorContent.scrollTop = editorContent.scrollHeight;
    
    // 更新加载状态
    loadingContent.textContent = '藤原: 视频解析完成!';
    
    // 增加成功统计
    successParseCount++;
    updateParseStats();
}

// 显示线路选择器
function showVideoApiSelector(originalUrl) {
    addAILine('可用解析线路:');
    
    // 创建线路选择容器
    const selectorContainer = document.createElement('div');
    selectorContainer.className = 'tool-container';
    
    // 头部
    const header = document.createElement('div');
    header.className = 'tool-header';
    
    const title = document.createElement('div');
    title.className = 'tool-title';
    title.innerHTML = '<i class="ri-list-settings-line"></i> 选择解析线路';
    
    const closeBtn = document.createElement('button');
    closeBtn.className = 'tool-close';
    closeBtn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
    closeBtn.addEventListener('click', () => selectorContainer.remove());
    
    header.appendChild(title);
    header.appendChild(closeBtn);
    
    // 内容区域
    const content = document.createElement('div');
    content.className = 'tool-content';
    content.style.padding = '15px';
    
    // 添加线路选项
    videoApis.forEach((api, index) => {
        const apiBtn = document.createElement('button');
        apiBtn.className = 'tool-btn';
        apiBtn.style.width = '100%';
        apiBtn.style.marginBottom = '10px';
        apiBtn.style.textAlign = 'left';
        apiBtn.innerHTML = `<i class="ri-play-line"></i> ${index + 1}. ${api.name}`;
        
        apiBtn.addEventListener('click', () => {
            switchVideoApi(originalUrl, index);
            selectorContainer.remove();
        });
        
        content.appendChild(apiBtn);
    });
    
    selectorContainer.appendChild(header);
    selectorContainer.appendChild(content);
    
    // 添加到编辑器内容区
    editorContent.appendChild(selectorContainer);
    editorContent.scrollTop = editorContent.scrollHeight;
}

// 切换视频解析线路
function switchVideoApi(originalUrl, apiIndex) {
    const api = videoApis[apiIndex];
    const apiUrl = api.url + encodeURIComponent(originalUrl);
    
    // 更新iframe的src
    const videoElement = document.getElementById('terminal-video');
    if (videoElement) {
        videoElement.src = apiUrl;
        
        // 更新当前线路显示
        const currentLine = document.querySelector('.video-controls span');
        if (currentLine) {
            currentLine.textContent = `当前线路: ${api.name}`;
        }
        
        addAILine(`已切换到 ${api.name}`);
    }
}

// ============== 短视频解析功能 ==============
async function parseShortVideo(url) {
    // 移除现有的解析结果
    const existingResult = document.querySelector('.short-video-result');
    if (existingResult) {
        existingResult.remove();
    }

    // 增加解析次数统计
    totalParseCount++;
    updateParseStats();

    // 显示加载状态
    const loadingLine = document.createElement('div');
    loadingLine.className = 'line';
    const loadingContent = document.createElement('div');
    loadingContent.className = 'line-content ai-output';
    loadingContent.textContent = '藤原: 正在解析短视频,请稍候...';
    loadingLine.appendChild(loadingContent);
    editorContent.appendChild(loadingLine);
    editorContent.scrollTop = editorContent.scrollHeight;

    // 检查URL是否有效
    if (!url || !url.startsWith('http')) {
        loadingContent.textContent = '藤原: 请输入有效的短视频URL';
        return;
    }

    try {
        // 构建API请求URL
        const params = new URLSearchParams({
            id: API_CONFIG.id,
            key: API_CONFIG.key,
            url: url.replace(/&/g, '<') // 替换&为<,根据API要求
        });
        
        const apiUrl = `${API_CONFIG.endpoints.shortVideo}?${params.toString()}`;
        
        // 发送请求
        const response = await fetch(apiUrl);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        
        if (data.code !== 200) {
            throw new Error(data.msg || '解析失败');
        }
        
        // 创建结果容器
        const resultContainer = document.createElement('div');
        resultContainer.className = 'tool-container short-video-result';
        
        // 头部
        const header = document.createElement('div');
        header.className = 'tool-header';
        
        const title = document.createElement('div');
        title.className = 'tool-title';
        title.innerHTML = `
            <i class="ri-video-line"></i>
            短视频解析结果
        `;
        
        const closeBtn = document.createElement('button');
        closeBtn.className = 'tool-close';
        closeBtn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
        closeBtn.addEventListener('click', () => resultContainer.remove());
        
        header.appendChild(title);
        header.appendChild(closeBtn);
        
        // 内容区域
        const content = document.createElement('div');
        content.className = 'tool-content';
        
        // 作者信息区域
        const authorInfo = `
            <div style="display: flex; align-items: center; margin-bottom: 15px; padding: 12px; background: rgba(var(--accentRGB), 0.1); border-radius: 8px;">
                <img src="${data.head?.[0] || 'https://picsum.photos/100/100'}" 
                     style="width: 40px; height: 40px; border-radius: 50%; margin-right: 12px; object-fit: cover;">
                <div style="flex: 1; overflow: hidden;">
                    <div style="font-weight: 600; color: var(--text-color); margin-bottom: 2px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden;">
                        ${data.name || '未知作者'}
                    </div>
                    <div style="font-size: 12px; color: var(--line-color); white-space: nowrap; text-overflow: ellipsis; overflow: hidden;">
                        ${data.signature || '暂无签名'}
                    </div>
                </div>
            </div>
        `;
        
        let mediaContent = '';
        
        if (data.type === "视频") {
            // 视频内容
            mediaContent = `
                <div style="position: relative; padding-top: 56.25%; margin-bottom: 15px; border-radius: 8px; overflow: hidden; background: #000;">
                    <video controls 
                           style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
                           poster="${data.cover || ''}"
                           crossorigin="anonymous">
                        <source src="${data.video || data.yvideo}" type="video/mp4">
                        您的浏览器不支持视频播放
                    </video>
                </div>
                <div class="tool-actions">
                    <button class="tool-btn" onclick="downloadVideo('${data.video || data.yvideo}', '${data.name || '短视频'}_${Date.now()}')">
                        <i class="ri-download-line"></i>
                        下载视频
                    </button>
                    <button class="tool-btn" onclick="showFullImage('${data.cover || ''}')">
                        <i class="ri-image-line"></i>
                        查看封面
                    </button>
                </div>
            `;
        } else if (data.type === "图集" && data.images && data.images.length > 0) {
            // 图集内容
            const galleryHTML = data.images.map((img, index) => `
                <div style="position: relative; margin-bottom: 10px;">
                    <img src="${img}" 
                         alt="图片 ${index + 1}"
                         style="width: 100%; border-radius: 8px; cursor: pointer;"
                         onclick="showFullImage('${img}')">
                    <div style="position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,0.7); color: white; padding: 4px 8px; border-radius: 12px; font-size: 12px;">
                        ${index + 1}/${data.images.length}
                    </div>
                </div>
            `).join('');
            
            mediaContent = `
                <div style="max-height: 400px; overflow-y: auto; margin-bottom: 15px;">
                    ${galleryHTML}
                </div>
                <div class="tool-actions">
                    <button class="tool-btn" onclick="downloadAllImages(${JSON.stringify(data.images).replace(/"/g, '&quot;')}, '${data.name || '图集'}_${Date.now()}')">
                        <i class="ri-download-line"></i>
                        打包下载 (${data.images.length}张)
                    </button>
                </div>
            `;
        } else {
            throw new Error('无法识别的媒体类型');
        }
        
        // 标题和描述
        const titleInfo = `
            <div style="margin-bottom: 15px; padding: 12px; background: rgba(var(--supportRGB), 0.1); border-radius: 8px;">
                <div style="font-weight: 600; color: var(--text-color); margin-bottom: 5px;">
                    ${data.title || '无标题'}
                </div>
                <div style="font-size: 12px; color: var(--line-color);">
                    发布于 ${data.create_time ? new Date(data.create_time * 1000).toLocaleString() : '未知时间'}
                </div>
            </div>
        `;
        
        // 音乐信息
        let musicInfo = '';
        if (data.musictitle) {
            musicInfo = `
                <div style="margin-top: 15px; padding: 12px; background: rgba(var(--featureRGB), 0.1); border-radius: 8px;">
                    <h4 style="color: var(--text-color); margin-bottom: 8px; display: flex; align-items: center; gap: 8px;">
                        <i class="ri-music-2-line"></i>
                        背景音乐
                    </h4>
                    <div style="font-size: 14px; color: var(--line-color); margin-bottom: 5px;">
                        ${data.musictitle}
                    </div>
                    <div style="font-size: 12px; color: var(--line-color);">
                        ${data.musicauthor || '未知作者'}
                    </div>
                </div>
            `;
        }
        
        content.innerHTML = authorInfo + titleInfo + mediaContent + musicInfo;
        resultContainer.appendChild(header);
        resultContainer.appendChild(content);
        
        // 添加到编辑器内容区
        editorContent.appendChild(resultContainer);
        editorContent.scrollTop = editorContent.scrollHeight;
        
        // 更新加载状态
        loadingContent.textContent = '藤原: 短视频解析完成!';
        
        // 增加成功统计
        successParseCount++;
        updateParseStats();
        
    } catch (error) {
        console.error('短视频解析失败:', error);
        loadingContent.textContent = `藤原: 短视频解析失败 - ${error.message}`;
        
        // 显示重试按钮
        const retryBtn = document.createElement('button');
        retryBtn.className = 'tool-btn';
        retryBtn.style.marginTop = '10px';
        retryBtn.innerHTML = '<i class="ri-refresh-line"></i> 重试';
        retryBtn.addEventListener('click', () => parseShortVideo(url));
        
        loadingLine.appendChild(retryBtn);
    }
}

// ============== 图片转换功能 ==============
function createImageConverter(targetFormat) {
    const existingConverter = document.querySelector('.image-converter');
    if (existingConverter) {
        existingConverter.remove();
        return;
    }
    
    const converter = document.createElement('div');
    converter.className = 'tool-container image-converter';
    
    // 头部
    const header = document.createElement('div');
    header.className = 'tool-header';
    
    const title = document.createElement('div');
    title.className = 'tool-title';
    title.innerHTML = `
        <i class="ri-image-line"></i>
        图片格式转换器
    `;
    
    const closeBtn = document.createElement('button');
    closeBtn.className = 'tool-close';
    closeBtn.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>';
    closeBtn.addEventListener('click', () => converter.remove());
    
    header.appendChild(title);
    header.appendChild(closeBtn);
    
    // 内容区域
    const content = document.createElement('div');
    content.className = 'tool-content';
    
    // 预览区域
    const previewContainer = document.createElement('div');
    previewContainer.className = 'tool-preview-container';
    
    const previewImage = document.createElement('img');
    previewImage.className = 'tool-preview';
    
    const placeholder = document.createElement('div');
    placeholder.className = 'tool-placeholder';
    placeholder.innerHTML = `
        <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
            <circle cx="8.5" cy="8.5" r="1.5"></circle>
            <polyline points="21 15 16 10 5 21"></polyline>
        </svg>
        <div>请选择要转换的图片</div>
        <div style="font-size:0.8em;margin-top:8px;opacity:0.7;">支持 JPG, PNG, WEBP, BMP 格式</div>
    `;
    
    previewContainer.appendChild(previewImage);
    previewContainer.appendChild(placeholder);
    
    // 尺寸设置区域
    const sizeControls = document.createElement('div');
    sizeControls.style.cssText = `
        display: flex;
        gap: 10px;
        margin: 15px 0;
        align-items: center;
    `;
    
    // 宽度输入
    const widthControl = document.createElement('div');
    widthControl.style.cssText = 'flex: 1;';
    widthControl.innerHTML = `
        <label style="display: block; margin-bottom: 5px; font-size: 12px; color: var(--dark);">宽度 (px)</label>
        <input type="number" id="imageWidth" class="tool-input" placeholder="自动" min="1" style="width: 100%;">
    `;
    
    // 高度输入
    const heightControl = document.createElement('div');
    heightControl.style.cssText = 'flex: 1;';
    heightControl.innerHTML = `
        <label style="display: block; margin-bottom: 5px; font-size: 12px; color: var(--dark);">高度 (px)</label>
        <input type="number" id="imageHeight" class="tool-input" placeholder="自动" min="1" style="width: 100%;">
    `;
    
    // 保持宽高比复选框
    const ratioControl = document.createElement('div');
    ratioControl.style.cssText = 'flex: 1; display: flex; align-items: center;';
    ratioControl.innerHTML = `
        <input type="checkbox" id="keepAspectRatio" checked style="margin-right: 8px;">
        <label for="keepAspectRatio" style="font-size: 12px; color: var(--dark);">保持宽高比</label>
    `;
    
    sizeControls.appendChild(widthControl);
    sizeControls.appendChild(heightControl);
    sizeControls.appendChild(ratioControl);
    
    // 格式信息
    const formatInfo = document.createElement('div');
    formatInfo.innerHTML = `
        <div class="tool-info">
            <strong>目标格式:</strong>${targetFormat.toUpperCase()}<br>
            <strong>支持格式:</strong>JPG, PNG, WEBP, BMP 等主流图片格式
        </div>
    `;
    
    // 操作按钮
    const actions = document.createElement('div');
    actions.className = 'tool-actions';
    
    const selectBtn = document.createElement('button');
    selectBtn.className = 'tool-btn';
    selectBtn.innerHTML = `
        <i class="ri-folder-open-line"></i>
        选择图片
    `;
    
    const convertBtn = document.createElement('button');
    convertBtn.className = 'tool-btn';
    convertBtn.innerHTML = `
        <i class="ri-refresh-line"></i>
        转换为 ${targetFormat.toUpperCase()}
    `;
    convertBtn.addEventListener('click', () => {
        if (!previewImage.src) {
            addAILine('请先选择要转换的图片');
            return;
        }
        
        // 获取尺寸设置
        const width = document.getElementById('imageWidth').value;
        const height = document.getElementById('imageHeight').value;
        const keepRatio = document.getElementById('keepAspectRatio').checked;
        
        convertImage(previewImage, targetFormat, {
            width: width ? parseInt(width) : null,
            height: height ? parseInt(height) : null,
            keepAspectRatio: keepRatio
        });
    });

    actions.appendChild(selectBtn);
    actions.appendChild(convertBtn);

    content.appendChild(previewContainer);
    content.appendChild(sizeControls);
    content.appendChild(formatInfo);
    content.appendChild(actions);

    converter.appendChild(header);
    converter.appendChild(content);

    editorContent.appendChild(converter);
    editorContent.scrollTop = editorContent.scrollHeight;
    
    // 创建临时文件输入元素
    const tempFileInput = document.createElement('input');
    tempFileInput.type = 'file';
    tempFileInput.accept = 'image/*';
    tempFileInput.style.display = 'none';
    
    // 点击选择按钮时触发文件选择
    selectBtn.addEventListener('click', () => {
        tempFileInput.click();
    });
    
    // 文件选择处理
    tempFileInput.addEventListener('change', (e) => {
        const file = e.target.files[0];
        if (!file) return;
        
        if (!file.type.match('image.*')) {
            addAILine('请选择有效的图片文件');
            return;
        }
        
        const reader = new FileReader();
        reader.onload = (event) => {
            previewImage.src = event.target.result;
            previewImage.classList.add('active');
            placeholder.style.display = 'none';
            
            // 图片加载完成后设置原始尺寸
            previewImage.onload = function() {
                const widthInput = document.getElementById('imageWidth');
                const heightInput = document.getElementById('imageHeight');
                
                widthInput.value = this.naturalWidth;
                heightInput.value = this.naturalHeight;
                
                // 计算原始宽高比
                const originalRatio = this.naturalWidth / this.naturalHeight;
                
                // 宽度变化时自动计算高度(如果保持宽高比)
                widthInput.addEventListener('input', function() {
                    if (document.getElementById('keepAspectRatio').checked && originalRatio) {
                        heightInput.value = Math.round(this.value / originalRatio);
                    }
                });
                
                // 高度变化时自动计算宽度(如果保持宽高比)
                heightInput.addEventListener('input', function() {
                    if (document.getElementById('keepAspectRatio').checked && originalRatio) {
                        widthInput.value = Math.round(this.value * originalRatio);
                    }
                });
            };
        };
        reader.readAsDataURL(file);
    });
}

// 图片转换函数
function convertImage(imgElement, format, options = {}) {
    try {
        const canvas = document.createElement('canvas');
        const ctx = canvas.getContext('2d');
        
        // 计算目标尺寸
        let targetWidth = options.width || imgElement.naturalWidth;
        let targetHeight = options.height || imgElement.naturalHeight;
        
        // 如果保持宽高比且只指定了一个尺寸
        if (options.keepAspectRatio) {
            const originalRatio = imgElement.naturalWidth / imgElement.naturalHeight;
            
            if (options.width && !options.height) {
                targetHeight = Math.round(options.width / originalRatio);
            } else if (!options.width && options.height) {
                targetWidth = Math.round(options.height * originalRatio);
            }
        }
        
        // 设置画布尺寸
        canvas.width = targetWidth;
        canvas.height = targetHeight;
        
        // 绘制图片(带缩放)
        ctx.drawImage(imgElement, 0, 0, targetWidth, targetHeight);
        
        // 确定MIME类型
        let mimeType;
        let quality = 0.9;
        
        switch (format.toLowerCase()) {
            case 'jpg':
            case 'jpeg':
                mimeType = 'image/jpeg';
                break;
            case 'png':
                mimeType = 'image/png';
                break;
            case 'webp':
                mimeType = 'image/webp';
                break;
            case 'bmp':
                mimeType = 'image/png';
                addAILine('注意:BMP格式将转换为PNG格式');
                break;
            default:
                mimeType = 'image/jpeg';
        }
        
        // 转换并下载
        canvas.toBlob((blob) => {
            if (!blob) {
                addAILine('图片转换失败,请重试');
                return;
            }
            
            const url = URL.createObjectURL(blob);
            const downloadLink = document.createElement('a');
            downloadLink.href = url;
            downloadLink.download = `converted-image-${Date.now()}.${format}`;
            
            // 触发下载
            document.body.appendChild(downloadLink);
            downloadLink.click();
            document.body.removeChild(downloadLink);
            
            // 清理URL对象
            setTimeout(() => URL.revokeObjectURL(url), 1000);
            
            addAILine(`图片已成功转换为 ${format.toUpperCase()} 格式并开始下载!`);
            addAILine(`文件大小: ${(blob.size / 1024).toFixed(1)}KB`);
            addAILine(`尺寸: ${targetWidth}x${targetHeight}px`);
            
        }, mimeType, quality);
        
    } catch (error) {
        addAILine(`图片转换失败: ${error.message}`);
    }
}

// ================ 通用工具函数 ================

// URL提取函数
function extractURL(text) {
    try {
        const urlRegex = /(https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*))/g;
        const matches = text.match(urlRegex);
        return matches ? matches[0] : null;
    } catch (e) {
        console.error('URL提取错误:', e);
        return null;
    }
}

// 显示全屏图片
function showFullImage(url) {
    const overlay = document.createElement('div');
    overlay.style.cssText = `
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.9);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        cursor: zoom-out;
    `;

    const img = document.createElement('img');
    img.src = url;
    img.style.maxWidth = '90%';
    img.style.maxHeight = '90%';
    img.style.borderRadius = '10px';

    overlay.onclick = () => overlay.remove();
    overlay.appendChild(img);
    document.body.appendChild(overlay);
}

// 下载所有图片
async function downloadAllImages(images, title) {
    if (!window.JSZip) {
        showAlert('打包下载功能需要JSZip库支持');
        return;
    }
    
    try {
        const zip = new JSZip();
        const imgFolder = zip.folder("images");
        
        showAlert('正在打包下载,请稍候...');
        
        const downloadPromises = images.map(async (imgUrl, index) => {
            try {
                const response = await fetch(imgUrl);
                if (!response.ok) throw new Error(`图片${index+1}下载失败`);
                const blob = await response.blob();
                imgFolder.file(`image_${index + 1}.jpg`, blob);
            } catch (error) {
                console.warn(`图片${index+1}下载失败:`, error);
            }
        });
        
        await Promise.all(downloadPromises);
        
        const zipBlob = await zip.generateAsync({
            type: "blob",
            compression: "DEFLATE",
            compressionOptions: { level: 6 }
        });
        
        const cleanTitle = title.replace(/[<>:"/\\|?*]/g, '');
        saveAs(zipBlob, `${cleanTitle}.zip`);
        
        showAlert('打包下载完成!');
        
    } catch (error) {
        console.error('打包下载失败:', error);
        showAlert('打包下载失败,请重试');
    }
}

// 下载视频
async function downloadVideo(url, title) {
    try {
        showAlert('正在下载视频,请稍候...');
        
        const response = await fetch(url);
        if (!response.ok) throw new Error(`下载失败: ${response.status}`);
        
        const blob = await response.blob();
        const cleanTitle = title.replace(/[<>:"/\\|?*]/g, '');
        saveAs(blob, `${cleanTitle}.mp4`);
        
        showAlert('视频下载完成!');
        
    } catch (error) {
        console.error('视频下载失败:', error);
        showAlert('视频下载失败,请重试');
    }
}

// 显示提示信息
function showAlert(message) {
    const alert = document.createElement('div');
    alert.style.cssText = `
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(30, 41, 59, 0.95);
        color: white;
        padding: 12px 24px;
        border-radius: 25px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        z-index: 9999;
        font-size: 14px;
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    `;
    alert.textContent = message;
    
    document.body.appendChild(alert);
    setTimeout(() => alert.remove(), 3000);
}

// 保存命令历史
function saveToHistory(command) {
    if (commandHistoryArray.length === 0 || commandHistoryArray[commandHistoryArray.length - 1] !== command) {
        commandHistoryArray.push(command);
        if (commandHistoryArray.length > 20) {
            commandHistoryArray.shift();
        }
        localStorage.setItem('commandHistory', JSON.stringify(commandHistoryArray));
    }
    historyIndex = -1;
}

// 显示命令历史
function showCommandHistory() {
    if (commandHistoryArray.length === 0) {
        addAILine('暂无命令历史记录');
        return;
    }
    
    addAILine('命令历史记录:');
    commandHistoryArray.slice().reverse().forEach((cmd, index) => {
        addAILine(`${commandHistoryArray.length - index}. ${cmd}`);
    });
}

// AI对话功能
async function sendMessage(message) {
    if (!message) return;
    
    const thinkingLine = document.createElement('div');
    thinkingLine.className = 'line';
    
    const thinkingContent = document.createElement('div');
    thinkingContent.className = 'line-content ai-output';
    thinkingContent.textContent = '藤原: 正在思考中...';
    
    thinkingLine.appendChild(thinkingContent);
    editorContent.appendChild(thinkingLine);
    editorContent.scrollTop = editorContent.scrollHeight;
    
    try {
        const endpoint = `${API_CONFIG.endpoints.ai}?id=${API_CONFIG.id}&key=${API_CONFIG.key}&words=${encodeURIComponent(message)}`;
        const response = await fetch(endpoint);
        
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        thinkingLine.remove();
        
        if (data.code === 200 && data.msg) {
            const replyLine = document.createElement('div');
            replyLine.className = 'line';
            
            const replyContent = document.createElement('div');
            replyContent.className = 'line-content ai-output';
            replyContent.textContent = '藤原: ';
            
            replyLine.appendChild(replyContent);
            editorContent.appendChild(replyLine);
            editorContent.scrollTop = editorContent.scrollHeight;
            
            await typeWriterEffect(replyContent, data.msg);
        } else {
            addAILine(`AI回复失败: ${data.msg || '未知错误'}`);
        }
    } catch (error) {
        thinkingLine.remove();
        addAILine(`AI服务暂时不可用: ${error.message}`);
        console.error('AI API错误:', error);
    }
}

async function pingWebsite(host) {
    // 显示加载状态
    const loadingLine = document.createElement('div');
    loadingLine.className = 'line';
    const loadingContent = document.createElement('div');
    loadingContent.className = 'line-content ai-output';
    loadingContent.textContent = '藤原: 正在测试ping...';
    loadingLine.appendChild(loadingContent);
    editorContent.appendChild(loadingLine);
    editorContent.scrollTop = editorContent.scrollHeight;

    try {
        // 构建API请求URL
        const params = new URLSearchParams({
            id: weatherConfig.id,
            key: weatherConfig.key,
            host: host
        });
        
        const apiUrl = `${API_CONFIG.endpoints.ping}?${params.toString()}`;
        
        // 发送请求
        const response = await fetch(apiUrl);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        
        const data = await response.json();
        
        if (data.code === 200) {
            // 成功响应
            loadingContent.textContent = '藤原: Ping测试完成!';
            
            // 创建结果行
            const resultLine = document.createElement('div');
            resultLine.className = 'line';
            
            const resultContent = document.createElement('div');
            resultContent.className = 'line-content ai-output';
            resultContent.style.whiteSpace = 'pre-wrap'; // 添加这行代码保留换行
            
            // 构建结果文本(使用模板字符串保持格式)
            const resultText = `Ping测试结果:
目标地址: ${data.host}
实际地址: ${data.realhost}
IP地址: ${data.ip}
延迟: ${data.time}毫秒
节点位置: ${data.dy}(${data.dz})`;
            
            resultContent.textContent = resultText;
            resultLine.appendChild(resultContent);
            editorContent.appendChild(resultLine);
            
        } else {
            throw new Error(data.msg || 'Ping测试失败');
        }
    } catch (error) {
        console.error('Ping测试失败:', error);
        loadingContent.textContent = `藤原: Ping测试失败 - ${error.message}`;
        
        // 显示重试按钮
        const retryBtn = document.createElement('button');
        retryBtn.className = 'tool-btn';
        retryBtn.style.marginTop = '10px';
        retryBtn.innerHTML = '<i class="ri-refresh-line"></i> 重试';
        retryBtn.addEventListener('click', () => pingWebsite(host));
        
        loadingLine.appendChild(retryBtn);
    }
    
    editorContent.scrollTop = editorContent.scrollHeight;
}

// 显示系统统计
function showStats() {
    addAILine('系统统计信息:');
    addAILine(`总解析次数: ${totalParseCount}`);
    addAILine(`成功解析次数: ${successParseCount}`);
    const rate = totalParseCount > 0 ? Math.round((successParseCount / totalParseCount) * 100) : 0;
    addAILine(`成功率: ${rate}%`);
    addAILine(`命令历史记录: ${commandHistoryArray.length} 条`);
    addAILine(`当前时间: ${new Date().toLocaleString()}`);
    addAILine(`浏览器: ${navigator.userAgent.split(' ')[0]}`);
}

// 处理命令输入
async function processCommand(input) {
    const command = input.trim().toLowerCase();
    const parts = input.trim().split(' ');
    const cmd = parts[0].toLowerCase();
    const args = parts.slice(1).join(' ');

    // 保存到历史记录
    saveToHistory(input.trim());

    // 添加用户输入行
    addUserLine(input);

    // 处理不同命令
    switch (cmd) {
        case 'help':
            addAILine(helpText);
            break;

        case 'clear':
            clearTerminal();
            addAILine('终端已清空');
            break;

        case 'history':
            showCommandHistory();
            break;

        case 'format':
            if (args) {
                const code = args;
                const type = detectCodeType(code);
                createCodeFormatter(code, type, 'format');
            } else {
                addAILine('请提供要格式化的代码,例如: format {"name":"John"}');
            }
            break;
            
        case 'minify':
            if (args) {
                const code = args;
                const type = detectCodeType(code);
                createCodeFormatter(code, type, 'minify');
            } else {
                addAILine('请提供要压缩的代码,例如: minify <div><p>Hello</p></div>');
            }
            break;
            
        case 'detect':
            if (args) {
                const code = args;
                const type = detectCodeType(code);
                addAILine(`检测到的代码类型: ${type}`);
            } else {
                addAILine('请提供要检测的代码,例如: detect SELECT * FROM users');
            }
            break;
            
        case 'set':
            if (parts[1] === 'indent' && parts[2]) {
                const size = parseInt(parts[2]);
                if (size >= 1 && size <= 8) {
                    indentSize = size;
                    addAILine(`缩进大小已设置为 ${size} 个空格`);
                } else {
                    addAILine('缩进大小必须在1-8之间');
                }
            } else {
                addAILine('无效的设置命令,使用: set indent [1-8]');
            }
            break;

        case 'video':
            if (args) {
                const url = extractURL(args) || args;
                parseVideo(url);
            } else {
                addAILine('请提供视频URL,例如: video https://v.qq.com/x/cover/xxx.html');
                addAILine('支持的平台: 爱奇艺、腾讯视频、优酷、芒果TV、哔哩哔哩等');
            }
            break;

        case 'shortvideo':
            if (args) {
                const url = extractURL(args) || args;
                parseShortVideo(url);
            } else {
                addAILine('请提供短视频URL,例如: shortvideo https://v.douyin.com/xxx');
                addAILine('支持的平台: 抖音、快手、小红书等');
            }
            break;

        case 'ai':
            if (args) {
                await sendMessage(args);
            } else {
                addAILine('请输入要对话的内容,例如: ai 你好');
            }
            break;

        case 'image':
            const format = args || 'jpg';
            const supportedFormats = ['jpg', 'jpeg', 'png', 'webp', 'bmp'];
            if (supportedFormats.includes(format.toLowerCase())) {
                createImageConverter(format.toLowerCase());
                addAILine(`图片转换器已启动,目标格式: ${format.toUpperCase()}`);
            } else {
                addAILine(`不支持的格式: ${format}`);
                addAILine(`支持的格式: ${supportedFormats.join(', ')}`);
            }
            break;

        case 'stats':
            showStats();
            break;

        case 'ping':
            if (args) {
                await pingWebsite(args);
            } else {
                addAILine('请提供要ping的网站或IP地址,例如: ping www.example.com');
            }
            break;
        
        default:
            // 检查是否包含URL,如果是则尝试解析
            const detectedUrl = extractURL(input);
            if (detectedUrl) {
                if (detectedUrl.includes('douyin.com') || detectedUrl.includes('kuaishou.com') || detectedUrl.includes('xiaohongshu.com')) {
                    parseShortVideo(detectedUrl);
                } else {
                    parseVideo(detectedUrl);
                }
            } else {
                addAILine(`未知命令: ${cmd}`);
                addAILine('输入 "help" 查看可用命令');
            }
            break;
    }
}

// 设置命令输入
function setCommandInput(command) {
    userInput.value = command;
    userInput.focus();
}

// 输入框事件处理
userInput.addEventListener('keydown', async (e) => {
    if (e.key === 'Enter') {
        e.preventDefault();
        const input = userInput.value.trim();
        if (input) {
            userInput.value = '';
            await processCommand(input);
        }
    } else if (e.key === 'ArrowUp') {
        e.preventDefault();
        if (historyIndex < commandHistoryArray.length - 1) {
            historyIndex++;
            userInput.value = commandHistoryArray[commandHistoryArray.length - 1 - historyIndex];
        }
    } else if (e.key === 'ArrowDown') {
        e.preventDefault();
        if (historyIndex > 0) {
            historyIndex--;
            userInput.value = commandHistoryArray[commandHistoryArray.length - 1 - historyIndex];
        } else if (historyIndex === 0) {
            historyIndex = -1;
            userInput.value = '';
        }
    }
});

// ================ 初始化 ================
document.addEventListener('DOMContentLoaded', async function() {
    // 聚焦到输入框
    userInput.focus();
    
    // 显示欢迎信息
    await addAILine("(。・ω・。)ノ♡ 欢迎来到藤原的数字空间");
    await addAILine("✨ 这里是一个融合创意与技术的终端世界");
    await addAILine("");
    await addAILine("💡 你可以:");
    await addAILine("- 输入 'help' 查看所有命令");
    await addAILine("- 直接粘贴视频/图片链接进行解析");
    await addAILine("- 使用快捷键提高效率");
    await addAILine("");
    await addAILine(`⏰ 当前时间: ${new Date().toLocaleString()}`);
    await addAILine("🌙 系统主题: " + (localStorage.getItem("theme") === "light" ? "明亮模式" : "暗黑模式"));
    await addAILine("");
    await addAILine("请开始你的探索之旅吧~");
});

// 防止页面刷新时丢失焦点
window.addEventListener('beforeunload', () => {
    localStorage.setItem('commandHistory', JSON.stringify(commandHistoryArray));
});

// 页面可见性变化时重新聚焦
document.addEventListener('visibilitychange', () => {
    if (!document.hidden) {
        setTimeout(() => userInput.focus(), 100);
    }
});

// 点击终端区域时聚焦输入框
editorContent.addEventListener('click', () => {
    userInput.focus();
});

// 键盘快捷键
document.addEventListener('keydown', (e) => {
    // Ctrl/Cmd + K 清空终端
    if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
        e.preventDefault();
        clearTerminal();
        addAILine('终端已清空 (快捷键: Ctrl/Cmd+K)');
    }
    
    // Ctrl/Cmd + L 聚焦输入框
    if ((e.ctrlKey || e.metaKey) && e.key === 'l') {
        e.preventDefault();
        userInput.focus();
        userInput.select();
    }
    
    // ESC 键清空当前输入
    if (e.key === 'Escape') {
        userInput.value = '';
        userInput.focus();
    }
    
    // Ctrl/Cmd + / 显示帮助
    if ((e.ctrlKey || e.metaKey) && e.key === '/') {
        e.preventDefault();
        processCommand('help');
    }
});

// 粘贴处理
userInput.addEventListener('paste', (e) => {
    setTimeout(() => {
        const pastedText = userInput.value;
        const url = extractURL(pastedText);
        if (url && url === pastedText.trim()) {
            // 如果粘贴的是纯URL,自动识别类型
            setTimeout(() => {
                userInput.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
            }, 100);
        }
    }, 10);
});

// 主题切换功能
if (localStorage.getItem("theme") === "light") {
  $('#checkbox').prop('checked', true)
}
var themeToggle = document.querySelector('.theme-switch input[type="checkbox"]');

function switchTheme(e) {
  console.log(themeToggle)
  if (e.target.checked) {
    document.documentElement.setAttribute("data-theme", "light");
    localStorage.setItem("theme", "light");
  } else {
    document.documentElement.setAttribute("data-theme", "dark");
    localStorage.setItem("theme", "dark");
  }
}
themeToggle.addEventListener("change", switchTheme, false);

// 用户菜单切换功能 - 简化版本
function usertoggle() {
  const linkmenu = document.getElementById('linkmenu');
  const container = document.getElementById('linkmenu-container');
  
  if (linkmenu.classList.contains("show")) {
    linkmenu.classList.remove("show");
    container.style.display = 'none';
  } else {
    linkmenu.classList.add("show");
    container.style.display = 'block';
  }
}

// 其他jQuery功能
$(document).ready(function() {
  $('div.topic-description descript:empty').hide();
  $('span.topic-desc:empty').hide();
  $('.pagination').html($('.pagination').html().split('&nbsp;').join(''));
  
  $('#ucpmenu p').each(function() {
    $(this).html($(this).html().replace(/· <a href="(.+?)" style="display: none;">(.+?)<\/a><br>/ig, ''));
  });
  $(".pformleft:contains('Date of Birth')").parent().hide();
  $(".pformstrip:contains('Your personal profile')").hide();
  
  var newMsg = parseInt("<!-- |new_msg| -->") != NaN ? parseInt("<!-- |new_msg| -->") : 0;
  if (newMsg > 0) {
    $(".nonewmsg").addClass("newmsg");
  } else {
    $(".nonewmsg").removeClass("newmsg");
  }
  
  var newAlert = parseInt("<!-- |new_alerts| -->") != NaN ? parseInt("<!-- |new_alerts| -->") : 0;
  if (newAlert > 0) {
    $(".nonewnotif").addClass("newnotif");
  } else {
    $(".nonewnotif").removeClass("newnotif");
  }
  
  $("#recent-topics").appendTo("#recent-topics-clip");
});


// 每日一言功能
async function fetchDailyQuote() {
    try {
        const response = await fetch('https://api.nnxv.cn/api/yiyan.php');
        const data = await response.json();
        
        const quoteContent = document.querySelector('.quote-content');
        const quoteFrom = document.querySelector('.quote-from');
        
        quoteContent.textContent = data.content;
        quoteFrom.textContent = `—— ${data.from}《${data.typeName}》`;
        
    } catch (error) {
        console.error('获取每日一言失败:', error);
        document.querySelector('.quote-content').textContent = '获取每日一言失败,请刷新重试';
    }
}

// 页面加载时获取每日一言
document.addEventListener('DOMContentLoaded', fetchDailyQuote);


  // 添加性能监控脚本
document.addEventListener('DOMContentLoaded', function() {
  // 记录页面加载开始时间
  const pageLoadStart = performance.now();
  let pageLoadedTime = null;  // 新增:保存页面加载完成的时间戳
  
  // 页面完全加载后计算加载时间
  window.addEventListener('load', function() {
    const pageLoadEnd = performance.now();
    const loadTime = (pageLoadEnd - pageLoadStart).toFixed(2);
    pageLoadedTime = new Date();  // 记录页面加载完成的时间点
    
    // 计算网站运行时间(从页面加载完成开始算起)
    function updateUptime() {
      if (!pageLoadedTime) return;
      
      const now = new Date();
      const uptime = Math.floor((now - pageLoadedTime) / 1000);  // 秒数
      
      const hours = Math.floor(uptime / 3600);
      const minutes = Math.floor((uptime % 3600) / 60);
      const seconds = uptime % 60;
      
      document.getElementById('performance-info').innerHTML = `
        | 加载耗时: ${loadTime}ms | 运行时长: ${hours}时${minutes}分${seconds}秒
      `;
    }
    
    // 初始更新
    updateUptime();
    
    // 每秒更新一次运行时间
    setInterval(updateUptime, 1000);
  });
});
  
  // ================ 美化版自定义弹窗 ================
// 添加自定义弹窗样式
const alertStyle = document.createElement('style');
alertStyle.textContent = `
  .custom-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    padding: 25px;
    border-radius: 16px;
    z-index: 99999;
    text-align: center;
    animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: rgba(var(--lighterRGB), 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(var(--accentRGB), 0.3);
    overflow: hidden;
  }
  
  .custom-alert p {
    margin: 0 0 20px;
    color: var(--dark);
    font-family: var(--fontBody);
    font-size: 16px;
    line-height: 1.6;
    padding: 0 10px;
  }
  
  .custom-alert .alert-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: var(--accent);
  }
  
  .custom-alert .alert-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
  }
  
  .custom-alert button {
    flex: 1;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--fontBody);
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s;
    border: none;
    outline: none;
  }
  
  .custom-alert .confirm-btn {
    background: rgba(var(--accentRGB), 0.8);
    color: white;
  }
  
  .custom-alert .confirm-btn:hover {
    background: rgba(var(--supportRGB), 0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
  
  @keyframes fadeIn {
    from { 
      opacity: 0; 
      transform: translate(-50%, -60%) scale(0.95);
    }
    to { 
      opacity: 1; 
      transform: translate(-50%, -50%) scale(1);
    }
  }
  
  @keyframes fadeOut {
    from { 
      opacity: 1;
      transform: translate(-50%, -50%) scale(1);
    }
    to { 
      opacity: 0;
      transform: translate(-50%, -40%) scale(0.95);
    }
  }
`;
document.head.appendChild(alertStyle);

// 创建美化版提示函数
function showCustomAlert(message, options = {}) {
  // 移除现有的提示
  const existingAlert = document.querySelector('.custom-alert');
  if (existingAlert) existingAlert.remove();
  
  // 创建弹窗元素
  const alertBox = document.createElement('div');
  alertBox.className = 'custom-alert';
  
  // 添加图标
  const icon = document.createElement('div');
  icon.className = 'alert-icon';
  icon.innerHTML = options.icon || '<i class="ri-information-line"></i>';
  alertBox.appendChild(icon);
  
  // 添加消息内容
  const messageEl = document.createElement('p');
  messageEl.textContent = message;
  alertBox.appendChild(messageEl);
  
  // 添加按钮容器
  const buttonsContainer = document.createElement('div');
  buttonsContainer.className = 'alert-buttons';
  
  // 添加确认按钮
  const confirmBtn = document.createElement('button');
  confirmBtn.className = 'confirm-btn';
  confirmBtn.textContent = options.confirmText || '我知道了';
  confirmBtn.addEventListener('click', () => {
    alertBox.style.animation = 'fadeOut 0.3s ease-out forwards';
    setTimeout(() => alertBox.remove(), 300);
    if (options.onConfirm) options.onConfirm();
  });
  buttonsContainer.appendChild(confirmBtn);
  
  alertBox.appendChild(buttonsContainer);
  
  // 添加到页面
  document.body.appendChild(alertBox);
  
  // 自动消失时间
  const autoCloseTime = options.autoClose || 5000;
  if (autoCloseTime > 0) {
    setTimeout(() => {
      if (alertBox.parentNode) {
        alertBox.style.animation = 'fadeOut 0.3s ease-out forwards';
        setTimeout(() => alertBox.remove(), 300);
      }
    }, autoCloseTime);
  }
  
  return {
    close: () => {
      alertBox.style.animation = 'fadeOut 0.3s ease-out forwards';
      setTimeout(() => alertBox.remove(), 300);
    }
  };
}

// ================ 美化版禁止功能实现 ================
// 禁止右键菜单
document.addEventListener('contextmenu', function(e) {
  e.preventDefault();
  showCustomAlert('为了保护内容安全,右键菜单功能已禁用', {
    icon: '<i class="ri-forbid-line"></i>',
    confirmText: '好的',
    autoClose: 3000
  });
});

// 禁止快捷键组合
const blockedShortcuts = [
  { 
    keys: ['F12'], 
    message: '开发者工具功能已禁用',
    icon: '<i class="ri-tools-line"></i>'
  },
  { 
    keys: ['u', 'U'], 
    ctrl: true, 
    message: '查看源代码功能已禁用',
    icon: '<i class="ri-code-view"></i>'
  },
  { 
    keys: ['i', 'I', 'j', 'J', 'c', 'C'], 
    ctrl: true, 
    shift: true,
    message: '开发者工具功能已禁用',
    icon: '<i class="ri-terminal-box-line"></i>'
  }
];

document.addEventListener('keydown', function(e) {
  for (const shortcut of blockedShortcuts) {
    const keyMatch = shortcut.keys.includes(e.key);
    const ctrlMatch = !shortcut.ctrl || (shortcut.ctrl && e.ctrlKey);
    const shiftMatch = !shortcut.shift || (shortcut.shift && e.shiftKey);
    
    if (keyMatch && ctrlMatch && shiftMatch) {
      e.preventDefault();
      e.stopPropagation();
      showCustomAlert(shortcut.message, {
        icon: shortcut.icon,
        confirmText: '明白了',
        autoClose: 3000
      });
      return;
    }
  }
});

  // ================ 其他保护措施 ================
// 防止iframe嵌套
//if (window !== top) {
//  top.location.href = window.location.href;
//}

</script>
</body>
</html>
        
预览
控制台