/* 变量定义 */
:root {
  --blur: 10px;
  --mask: 0.3;
  --bg-blur: 2px;
  --bg-mask: 0.015;
  --text-color: #000;
  --link-color: #0077cc;
  --bg-mask-r: 255;
  --bg-mask-g: 255;
  --bg-mask-b: 255;
}
[data-theme="dark"] {
  /* 页面背景 */
  --bg-blur: 2px;
  --bg-mask: 0.2;
  /* 卡片背景 */
  --blur: 10px;
  --mask: 0.3;
  --text-color: #fff;
  --link-color: #66aaff;
  --bg-mask-r: 0;
  --bg-mask-g: 0;
  --bg-mask-b: 0;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* 网页背景及遮罩 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('background.jpg') no-repeat center center/cover;
  filter: blur(var(--bg-blur));
  z-index: 0;
}
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(var(--bg-mask-r), var(--bg-mask-g), var(--bg-mask-b), var(--bg-mask));
  z-index: 0;
}

/* 浮入动画 */
@keyframes floatIn {
  from { opacity: 0; transform: translate(-50%, -55%) scale(0.75); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 右上角全局控制面板 */
.controls-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background-color: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(5px);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 2;
}
[data-theme="dark"] .controls-panel {
  background-color: rgba(0, 0, 0, 0.5);
}
.controls-panel label {
  color: var(--text-color);
}
.controls-panel input,
.controls-panel select {
  margin-left: 0.25rem;
}

.controls-panel input[type="range"],
.controls-panel label:not(:last-child) {
  display: none;
}

/* 主题切换按钮 */
.theme-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000; /* 确保在最上层 */
}

#theme-toggle-button {
  background-color: transparent; /* Explicitly set transparent background */
  border: none; /* Flat style */
  color: var(--text-color); /* Use theme's text color for icon */
  padding: 0.3rem; /* Add some padding around the icon */
  border-radius: 50%; /* Make it circular */
  cursor: pointer;
  font-size: 1rem; /* Adjust icon size if needed */
  width: 40px; /* Keep size or adjust as needed */
  height: 40px; /* Keep size or adjust as needed */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease, transform 0.2s ease, color 0.3s ease; /* Remove backdrop-filter from transition */
}

#theme-toggle-button span {
  line-height: 1; /* Center icon vertically */
}

#theme-toggle-button:hover {
  background-color: rgba(128, 128, 128, 0.1); /* Subtle hover effect */
}

#theme-toggle-button:active {
  transform: scale(0.95);
}

[data-theme="dark"] #theme-toggle-button:hover {
  background-color: rgba(200, 200, 200, 0.1);
}

.card {
  position: absolute;
  top: 40%;
  left: 50%;
  opacity: 0;
  animation: floatIn 0.6s ease-out 0.2s forwards;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-areas:
    "avatar description"
    "controls controls"
    "links links";
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 2rem;
  border-radius: 1rem;
  background-color: rgba(255, 255, 255, var(--mask));
  backdrop-filter: blur(var(--blur));
  color: var(--text-color);
  min-width: 450px;
  width: auto;
  max-width: 90%;
  z-index: 1;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover {
  transform: translate(-50%, -50%) scale(1.03);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
[data-theme="dark"] .card {
  background-color: rgba(0, 0, 0, var(--mask));
}

.avatar {
  grid-area: avatar;
}
.avatar img {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.avatar img:hover {
  transform: translateY(-3px);
}

.avatar-name {
  text-align: center; /* 文本居中 */
  margin-top: 0.5rem; /* 向下移动一点 */
  font-size: 1rem; /* 可以调整字体大小 */
  color: var(--text-color); /* 使用主题文本颜色 */
  transition: transform 0.3s ease, color 0.3s ease; /* 添加过渡效果 */
}

.avatar-name:hover {
  transform: translateY(-3px); /* 悬停时向上移动一点 */
  color: var(--link-color); /* 悬停时使用链接颜色 */
}

/* 修复描述区选择器 */
.description {
  grid-area: description;
  align-self: center;
}
.description p {
  transition: transform 0.3s ease, color 0.3s ease;
}
.description p:hover {
  transform: translateY(-3px);
  color: var(--link-color);
}

.controls {
  grid-area: controls;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.controls label,
.controls input {
  margin-bottom: 0.25rem;
}

.links {
  grid-area: links;
  display: flex;
  gap: 1rem;
  justify-content: center;
}
.links a {
  color: var(--link-color);
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease;
}
.links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--link-color);
  transition: all 0.3s ease;
}
.links a:hover {
  color: var(--link-color);
}
.links a:hover::after {
  left: 0;
  width: 100%;
}

/* 法阵样式 */
.magic-circle-container {
  position: fixed !important; /* 强制 fixed 定位 */
  bottom: 20px !important; /* 强制距离底部 */
  right: 20px !important;  /* 强制距离右侧 */
  top: auto !important;    /* 确保 top 不干扰 */
  left: auto !important;   /* 确保 left 不干扰 */
  width: 150px;
  height: 150px;
  display: flex; /* 使用 Flexbox 布局 */
  justify-content: center; /* 水平居中 */
  align-items: center;    /* 垂直居中 */
}

.magic-circle {
  max-width: 100%;
  max-height: 100%;
  display: block; /* 确保 img 是块级 */
}

.outer-circle {
  width: 100%;
  height: 100%;
  position: relative; /* 作为内圈绝对定位的参考 */
  opacity: 0.5; /* 降低外圈透明度 */
}

.inner-circle {
  width: 78%; /* 内圈大小 */
  height: 78%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: auto;
  opacity: 0.6; /* 设置内圈透明度 (可以设为不同值) */
}
