:root {
  --bg: #0a0b0f;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(70, 84, 120, 0.18), transparent 60%),
    radial-gradient(1000px 600px at -10% 30%, rgba(217, 255, 72, 0.04), transparent 55%),
    var(--bg);
  color: #e8e6e0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

body[data-theme="light"] {
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(140, 160, 220, 0.18), transparent 60%),
    radial-gradient(1000px 600px at -10% 30%, rgba(217, 255, 72, 0.08), transparent 55%),
    #eef0f5;
  color: #17181c;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 60%, rgba(5, 6, 9, 0.45) 100%),
    linear-gradient(180deg, rgba(5, 6, 9, 0.22), transparent 20%, transparent 80%, rgba(5, 6, 9, 0.32));
}

body[data-theme="light"] .vignette {
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(226, 230, 238, 0.85) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), transparent 18%, transparent 82%, rgba(226, 230, 238, 0.6));
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  filter: blur(var(--dblur, 0px)) brightness(var(--dbright, 1));
  transition: opacity 0.9s var(--ease), filter 0.9s ease;
  will-change: transform, opacity, filter;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.tile.is-visible {
  opacity: var(--dopacity, 1);
}

.tile.is-leaving {
  opacity: 0;
  filter: blur(6px);
}

.tile:hover {
  filter: blur(var(--dblur, 0px)) brightness(calc(var(--dbright, 1) + 0.12));
  border-color: rgba(217, 255, 72, 0.4);
  z-index: 5;
}

/* Liquid glass pane */
.glass-pane {
  --glass-radius: 60px;
  --glass-width: 320px;
  --glass-height: 200px;
  --tint-color: 255, 255, 255;
  --tint-opacity: 0.06;
  --shadow-blur: 20px;
  --shadow-spread: -5px;
  --shadow-color: rgba(255, 255, 255, 0.45);
  --outer-shadow-blur: 26px;

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: var(--glass-width);
  height: var(--glass-height);
  max-width: 76vw;
  max-height: 66vh;
  border-radius: var(--glass-radius);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
  cursor: default;
  box-shadow: 0 4px var(--outer-shadow-blur) rgba(0, 0, 0, 0.22);
}

.glass-pane::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background-color: rgba(var(--tint-color), var(--tint-opacity));
  box-shadow: inset 0 0 var(--shadow-blur) var(--shadow-spread) var(--shadow-color);
  pointer-events: none;
  transition: background-color 0.5s ease;
}

.glass-pane:hover::before {
  background-color: rgba(10, 11, 15, 0.16);
}

body[data-theme="light"] .glass-pane:hover::before {
  background-color: rgba(255, 255, 255, 0.32);
}

.glass-pane::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  overflow: hidden;
  clip-path: inset(0 round var(--glass-radius));
  backdrop-filter: url(#liquid-glass-filter);
  -webkit-backdrop-filter: url(#liquid-glass-filter);
}

.glass-center {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.glass-circle {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.25),
    inset 0 0 8px rgba(255, 255, 255, 0.08);
  transform: translateY(-6px);
  transition: transform 0.5s var(--ease);
}

.glass-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.glass-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 4px);
  margin-top: 0;
  margin-right: -0.1em;
  white-space: nowrap;
  text-align: center;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.5s ease 0.12s, transform 0.5s ease 0.12s;
  user-select: text;
  -webkit-user-select: text;
}

.glass-pane:hover .glass-circle {
  transform: translateY(-22px);
}

.glass-pane:hover .glass-name {
  opacity: 1;
  transform: translate(-50%, 0);
}

body[data-theme="light"] .glass-circle {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.22);
  box-shadow:
    0 2px 14px rgba(0, 0, 0, 0.12),
    inset 0 0 8px rgba(255, 255, 255, 0.5);
}

body[data-theme="light"] .glass-name {
  color: rgba(16, 18, 22, 0.9);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.6);
}

@media (max-width: 640px) {
  .glass-pane {
    --glass-radius: 44px;
    --glass-width: 240px;
    --glass-height: 150px;
  }
  .glass-circle {
    width: 68px;
    height: 68px;
  }
  .glass-name {
    font-size: 16px;
  }
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 20, 26, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #e8e6e0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.theme-toggle:hover {
  transform: scale(1.06);
}

body[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.12);
  color: #17181c;
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .tile.is-visible,
  .tile.is-leaving {
    transition: opacity 0.6s ease;
  }
}
