/* =========================================================
   0. 全局重置
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* =========================================================
   1. 背景层（深色渐变 + 漂移光斑 + 纹理覆盖）
   ========================================================= */

body {
  position: relative;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Noto Sans SC", sans-serif;
  --glass-blur: 20px;
  --glow-opacity: 0.4;
  --glow-blur: 20px;
  --card-shadow-alpha: 0.4;
  --card-shadow-alpha-hover: 0.53;
  --mesh-duration: 48s;
  --bg-texture-alpha: 0.01;
  --bg-texture-opacity: 0.4;
  --bg-texture-gap: 6px;

  background:
    radial-gradient(circle at 39% 41%, rgba(102, 126, 234, 0.68), transparent 76%),
    radial-gradient(circle at 76% 48%, rgba(118, 75, 162, 0.62), transparent 76%),
    radial-gradient(circle at 52% 34%, rgba(240, 147, 251, 0.50), transparent 76%),
    radial-gradient(circle at 77% 84%, rgba(79, 172, 254, 0.70), transparent 76%),
    radial-gradient(circle at 65% 18%, rgba(67, 233, 123, 0.52), transparent 76%),
    #1a1a2e;

  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  overflow: hidden;
  background-size: 140% 140%;
  animation: meshFloat var(--mesh-duration) ease-in-out infinite alternate;
}

/* 背景纹理覆盖层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, var(--bg-texture-alpha)) 0px,
      rgba(255, 255, 255, var(--bg-texture-alpha)) 1px,
      transparent 1px,
      transparent var(--bg-texture-gap)
    );
  opacity: var(--bg-texture-opacity);
  mix-blend-mode: soft-light;
}

@keyframes meshFloat {
  0% {
    background-position: 0% 0%;
  }
  50% {
    background-position: 6% 4%;
  }
  100% {
    background-position: 2% 8%;
  }
}

/* =========================================================
   2. 布局容器
   ========================================================= */

.wrapper {
  width: 100%;
  max-width: 720px;
  position: relative;
  perspective: var(--perspective, 2000px);
  text-align: center;
  padding-bottom: 8px;
}

/* =========================================================
   3. 主卡片（液态玻璃 + 3D 视差 + 鼠标光追）
   ========================================================= */

.card {
  position: relative;
  margin: 0 auto;
  text-align: left;
  min-height: var(--card-min-height, auto);
  display: flex;
  flex-direction: column;

  /* 宽度保持最大约640px */
  width: 100%;
  max-width: 720px;

  background: rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  padding: 26px 28px 22px;

  border: 1px solid rgba(255, 255, 255, 0.24);

  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.30),
    0 20px 60px rgba(0, 0, 0, var(--card-shadow-alpha));

  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: #f9fafb;

  transform-style: preserve-3d;
  will-change: transform;
  transition:
    transform 0.26s cubic-bezier(.23,1,.32,1),
    box-shadow 0.32s cubic-bezier(.23,1,.32,1);
}

body.fx-enabled .card:hover {
  transform: translateY(-1.8px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.30),
    0 26px 70px rgba(0, 0, 0, var(--card-shadow-alpha-hover));
}

/* 顶层：轻微玻璃纹理（常驻） */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;

  background:
    radial-gradient(
      circle at 12% 0%,
      rgba(255, 255, 255, 0.22),
      transparent 55%
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.015) 0px,
      rgba(255, 255, 255, 0.015) 1px,
      transparent 2px,
      transparent 4px
    );

  opacity: 0.32;
  mix-blend-mode: soft-light;
  animation: glassNoise 10s ease-in-out infinite alternate;
}

@keyframes glassNoise {
  0%   { opacity: 0.28; }
  100% { opacity: 0.38; }
}

/* 底层：鼠标追踪光晕；桌面端依赖 hover，触屏端由 JS 切换 touch-glow-active */
.card::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  pointer-events: none;

  background:
    radial-gradient(
      circle at var(--glow-x, 50%) var(--glow-y, 50%),
      rgba(255, 255, 255, 0.45),
      rgba(255, 255, 255, 0.18) 15%,
      rgba(255, 255, 255, 0.04) 33%,
      transparent 45%
    ),
    radial-gradient(
      circle at calc(var(--glow-x, 50%) + 6%) calc(var(--glow-y, 50%) + 4%),
      rgba(185, 210, 255, 0.18),
      transparent 55%
    ),
    radial-gradient(
      circle at calc(var(--glow-x, 50%) - 6%) calc(var(--glow-y, 50%) - 5%),
      rgba(255, 190, 220, 0.18),
      transparent 55%
    );

  opacity: 0;
  mix-blend-mode: screen;
  filter: blur(var(--glow-blur));
  transition: opacity 0.22s ease-out;
}

/* 高级效果 + 鼠标光追开启 + hover 时，追踪光晕渐变显现 */
body.fx-enabled.mouse-glow-on .card:hover::after {
  opacity: var(--glow-opacity);
}

/* 触屏端：在触摸过程中显示光追 */
body.fx-enabled.mouse-glow-on.touch-glow-active .card::after {
  opacity: var(--glow-opacity);
}

/* 鼠标光追临时暂停（比如悬停在控件上） */
body.fx-enabled.mouse-glow-on.mouse-glow-paused .card:hover::after {
  opacity: 0;
}

body.fx-enabled.mouse-glow-on.mouse-glow-paused.touch-glow-active .card::after {
  opacity: 0;
}

/* =========================================================
   4. 标题 + 右侧区域
   ========================================================= */

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #f9fafb;
}

.title-accent {
  position: relative;
  display: inline-block;
  font-weight: 600;
  color: #cbd5f5;
}

/* 标题流光仅在高级效果开启时存在 */
body.fx-enabled .title-accent::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 1),
    rgba(255, 255, 255, 0)
  );
  background-size: 320% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;

  pointer-events: none;
  mix-blend-mode: screen;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.9));

  animation: internalFlow 2.6s linear infinite;
}

@keyframes internalFlow {
  0%   { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin-top: 2px;
}

/* =========================================================
   5. Operational 状态徽章
   ========================================================= */

.status-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  z-index: 2;

  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  overflow: hidden;
}

.status-content {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  z-index: 3;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #34c759;
  box-shadow:
    0 0 2px rgba(52, 199, 89, 0.75),
    0 0 5px rgba(52, 199, 89, 0.5);
  animation: dotPulse 1.8s ease-in-out infinite;
}

@keyframes dotPulse {
  0% {
    transform: scale(1);
    opacity: 0.9;
    box-shadow:
      0 0 2px rgba(52, 199, 89, 0.6),
      0 0 4px rgba(52, 199, 89, 0.35);
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
    box-shadow:
      0 0 4px rgba(52, 199, 89, 0.9),
      0 0 7px rgba(52, 199, 89, 0.7);
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
    box-shadow:
      0 0 2px rgba(52, 199, 89, 0.6),
      0 0 4px rgba(52, 199, 89, 0.35);
  }
}

.status-label {
  color: #f0fff4;
  font-weight: 600;
  text-shadow:
    0 0 3px rgba(15, 23, 42, 0.9),
    0 0 6px rgba(15, 23, 42, 0.7);
}

/* 徽章扫光 + 液态噪声，仅在 fx-enabled 时运行 */
body.fx-enabled .status-badge::before {
  position: absolute;
  content: "";
  display: inline-block;
  top: -180px;
  left: 0;
  width: 30px;
  height: 100%;
  background-color: #fff;
  pointer-events: none;

  transform: scale(0) rotate(45deg);
  animation: shiny-btn1 6s ease-in-out infinite;
  opacity: 0.35;
}

body.fx-enabled .status-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.05);
  filter: url(#liquid-glass);
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}

/* =========================================================
   6. 语言切换 segmented control
   ========================================================= */

.lang-switch {
  position: relative;
  display: flex;
  background: rgba(255, 255, 255, 0.3);
  padding: 3px;
  border-radius: 99px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.4);
  z-index: 2;
}

.lang-switch-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  height: calc(100% - 4px);
  width: calc((100% - 4px) / 3);
  border-radius: 999px;
  background: rgba(248, 250, 252, 0.96);
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.55),
    0 0 0 1px rgba(148, 163, 184, 0.6);
  transition:
    transform 0.22s ease-out,
    opacity 0.18s ease-out,
    width 0.18s ease-out;
  pointer-events: none;
}

.lang-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: #e5e7eb;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0.78;
  transition:
    color 0.18s ease,
    opacity 0.18s ease;
}

.lang-btn.is-active {
  color: #0f172a;
  opacity: 1;
}

@media (hover: hover) {
  .lang-btn:hover {
    opacity: 1;
  }
}

/* =========================================================
   7. 主体文案
   ========================================================= */

.main-info {
  margin-top: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.desc {
  margin: 8px 0;
  font-size: 15.5px;
  line-height: 1.75;
  color: #f3f4f6;
  opacity: 0.94;
}

.link {
  color: #add8ff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.link:hover {
  color: #e2efff;
  text-shadow: 0 0 8px rgba(148, 197, 255, 0.45);
  text-decoration: underline;
}

.notice {
  margin-top: 14px;
  font-size: 12.5px;
  color: #e5e7eb;
  opacity: 0.78;
  line-height: 1.6;
}

/* =========================================================
   8. 高级效果按钮 + 子功能按钮
   ========================================================= */

.fx-toggle,
.mouse-glow-toggle,
.tilt-toggle {
  margin-top: 16px;
  padding: 10px 30px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;

  position: relative;
  overflow: hidden;

  background: linear-gradient(120deg, #6366f1, #ec4899);
  color: #fdfcff;

  box-shadow:
    0 12px 25px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.14);

  transition:
    background 0.25s ease,
    box-shadow 0.25s ease,
    transform 0.15s ease,
    color 0.25s ease,
    opacity 0.25s ease;
}

/* 调试控件：默认隐藏，长按 footer 后临时显示 */
.mouse-glow-toggle {
  margin-top: 10px;
  display: none;
}

/* 调试控件：默认隐藏，长按 footer 后临时显示 */
.tilt-toggle {
  margin-top: 10px;
  display: none;
}

/* 调试控件：默认隐藏，长按 footer 后临时显示 */
.fx-sliders {
  margin-top: 10px;
  display: none;
  gap: 10px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.fx-group {
  width: auto;
  max-width: none;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.22);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition:
    max-width 0.26s ease,
    border-radius 0.26s ease,
    background 0.26s ease,
    box-shadow 0.26s ease;
  flex: 0 0 auto;
  will-change: max-width, border-radius, background;
}

.fx-group[open] {
  width: 100%;
  max-width: min(360px, 100%);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.28);
  flex: 1 1 100%;
}

.fx-group-title {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.45);
  text-transform: uppercase;
  user-select: none;
  white-space: nowrap;
}

.fx-group-title::marker {
  content: "";
}

.fx-group-title::after {
  content: "+";
  font-size: 13px;
  opacity: 0.85;
}

.fx-group[open] .fx-group-title::after {
  content: "–";
}

.fx-group-body {
  padding: 10px 12px 12px;
  display: grid;
  gap: 10px;
  justify-items: center;
  width: 100%;
  max-height: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 0.28s ease,
    opacity 0.22s ease,
    transform 0.22s ease;
  overflow: hidden;
}

.fx-group[open] .fx-group-body {
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
}

.fx-slider-row {
  display: grid;
  grid-template-columns: 68px minmax(160px, 220px) 42px;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 360px;
  color: #e5e7eb;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.fx-slider-label {
  text-align: right;
  opacity: 0.85;
}

.fx-slider-value {
  text-align: left;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.fx-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.9), rgba(236, 72, 153, 0.9));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
  outline: none;
}

.fx-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(148, 163, 184, 0.6);
  cursor: pointer;
}

.fx-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: #f8fafc;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(148, 163, 184, 0.6);
  cursor: pointer;
}

/* 正式视图下隐藏调试控件 */
.fx-toggle,
.mouse-glow-toggle,
.tilt-toggle,
.fx-sliders {
  display: none !important;
}

/* 长按 footer 临时显示调试控件 */
body.debug-controls-on .fx-toggle,
body.debug-controls-on .mouse-glow-toggle,
body.debug-controls-on .tilt-toggle,
body.debug-controls-on .fx-sliders {
  display: inline-block !important;
}

body.debug-controls-on .fx-sliders {
  display: flex !important;
}

/* 开启状态样式（高级效果 / 子功能按钮） */

.fx-toggle::before,
.mouse-glow-toggle::before,
.tilt-toggle::before {
  position: absolute;
  content: "";
  display: inline-block;
  top: -180px;
  left: 0;
  width: 30px;
  height: 100%;
  background-color: #fff;
  opacity: 0;
  pointer-events: none;

  transform: scale(0) rotate(45deg);
  animation: shiny-btn1 3s ease-in-out infinite;
}

/* 关闭状态样式（高级效果 / 子功能按钮） */
.fx-toggle.fx-off,
.mouse-glow-toggle.fx-off,
.tilt-toggle.fx-off {
  background: linear-gradient(120deg, #4b5563, #111827);
  color: #e5e7eb;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(148, 163, 184, 0.35);
  opacity: 0.9;
}

.fx-toggle.fx-off::before,
.mouse-glow-toggle.fx-off::before,
.tilt-toggle.fx-off::before {
  opacity: 0;
  animation: none;
}

/* Hover / Active */
.fx-toggle:hover,
.mouse-glow-toggle:hover,
.tilt-toggle:hover {
  transform: translateY(-1px);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.65),
    0 0 0 1px rgba(255, 255, 255, 0.18);
}

.fx-toggle:active,
.mouse-glow-toggle:active,
.tilt-toggle:active {
  transform: translateY(1px);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(15, 23, 42, 0.9);
}

/* 按钮 / 徽章扫光动画 */
@-webkit-keyframes shiny-btn1 {
  0% {
    -webkit-transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  80% {
    -webkit-transform: scale(0) rotate(45deg);
    opacity: 0.5;
  }
  81% {
    -webkit-transform: scale(4) rotate(45deg);
    opacity: 1;
  }
  100% {
    -webkit-transform: scale(50) rotate(45deg);
    opacity: 0;
  }
}

@keyframes shiny-btn1 {
  0% {
    transform: scale(0) rotate(45deg);
    opacity: 0;
  }
  80% {
    transform: scale(0) rotate(45deg);
    opacity: 0.5;
  }
  81% {
    transform: scale(4) rotate(45deg);
    opacity: 1;
  }
  100% {
    transform: scale(50) rotate(45deg);
    opacity: 0;
  }
}

/* =========================================================
   9. 底部版权 + 响应式
   ========================================================= */

.footer {
  margin-top: 26px;
  font-size: 11px;
  color: #d1d5db;
  opacity: 0.7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  line-height: 1.35;
  letter-spacing: 0.04em;
}

.footer-line {
  display: block;
}

/* 调试模式下的 footer 放大，方便作为状态提示 */
body.debug-controls-on .footer {
  font-size: 16px;
}

@media (max-width: 480px) {
  body {
    padding: 26px 14px;
  }

  .card {
    padding: 18px 18px 22px;
    border-radius: 20px;
  }

  .title {
    font-size: 19px;
  }

  .desc {
    font-size: 14px;
    line-height: 1.68;
  }

  .header-right {
    align-items: flex-start;
    gap: 8px;
  }

  .lang-switch {
    margin-top: 2px;
  }

  .fx-toggle,
  .mouse-glow-toggle,
  .tilt-toggle {
    margin-top: 14px;
  }

  .fx-sliders {
    margin-top: 8px;
  }
}
