:root {
  color-scheme: dark;
  --bg: #090b11;
  --panel: rgba(18, 21, 30, .78);
  --panel-border: rgba(255, 255, 255, .09);
  --text: #f7f8fc;
  --muted: #9ca4b8;
  --card: rgba(255, 255, 255, .06);
  --card-hover: rgba(255, 255, 255, .1);
  --accent: #8b5cf6;
  --accent-2: #38bdf8;
  --shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f7;
  --panel: rgba(255, 255, 255, .76);
  --panel-border: rgba(20, 24, 36, .09);
  --text: #161925;
  --muted: #687085;
  --card: rgba(255, 255, 255, .7);
  --card-hover: rgba(255, 255, 255, .96);
  --shadow: 0 30px 80px rgba(61, 68, 92, .18);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
  transition: background .35s ease, color .35s ease;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.background { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.background::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}
.orb { position: absolute; border-radius: 999px; filter: blur(2px); opacity: .55; animation: float 11s ease-in-out infinite; }
.orb-one { width: 380px; height: 380px; background: radial-gradient(circle, #7c3aed 0, transparent 68%); left: -100px; top: -120px; }
.orb-two { width: 420px; height: 420px; background: radial-gradient(circle, #0284c7 0, transparent 70%); right: -140px; top: 18%; animation-delay: -4s; }
.orb-three { width: 300px; height: 300px; background: radial-gradient(circle, #db2777 0, transparent 70%); left: 35%; bottom: -170px; animation-delay: -7s; }
@keyframes float { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(20px,-25px,0) scale(1.08); } }

.page-shell { min-height: 100vh; display: grid; place-items: center; padding: 46px 18px; position: relative; z-index: 1; }
.profile-card {
  width: min(100%, 570px); position: relative; padding: 44px 34px 28px;
  border: 1px solid var(--panel-border); border-radius: 32px;
  background: var(--panel); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  box-shadow: var(--shadow); overflow: hidden;
}
.profile-card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent); opacity: .55;
}
.theme-toggle {
  position: absolute; top: 19px; right: 20px; width: 42px; height: 42px; border: 1px solid var(--panel-border);
  border-radius: 14px; background: var(--card); color: var(--text); cursor: pointer; display: grid; place-items: center;
  transition: transform .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(5deg); background: var(--card-hover); }
.theme-icon { font-size: 18px; }
.avatar-wrap {
  --avatar-size: 112px;
  --ring-size: 7px;

  position: relative;
  width: max-content;
  margin: 0 auto 22px;
}

/* 外框容器 */
.avatar-ring {
  position: relative;

  width: calc(var(--avatar-size) + var(--ring-size) * 2);
  height: calc(var(--avatar-size) + var(--ring-size) * 2);

  display: grid;
  place-items: center;

  border-radius: 50%;
  isolation: isolate;
}

/* 藍紫色液體外框 */
.avatar-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;

  background:
    radial-gradient(
      circle at 30% 20%,
      #93c5fd 0%,
      #3b82f6 30%,
      #6366f1 58%,
      #8b5cf6 78%,
      #4f46e5 100%
    );

  border-radius:
    48% 52% 56% 44% /
    52% 44% 56% 48%;

  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.55),
    0 0 28px rgba(139, 92, 246, 0.35);

  animation:
    avatar-liquid 4.5s ease-in-out infinite,
    avatar-glow 2.5s ease-in-out infinite alternate;
}

/* 向外擴散的水波 */
.avatar-ring::after {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: -1;

  border: 2px solid rgba(99, 102, 241, 0.6);
  border-radius: 50%;

  opacity: 0;
  animation: avatar-ripple 2.8s ease-out infinite;
}

/* 頭像本體 */
.avatar {
  position: relative;
  z-index: 2;

  width: var(--avatar-size);
  height: var(--avatar-size);

  display: block;
  object-fit: cover;
  object-position: center;

  border-radius: 50%;

  /* 讓圖片和液體外框之間有一道細縫 */
  border: 3px solid var(--panel);
  background: var(--panel);

  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.14),
    0 6px 20px rgba(37, 99, 235, 0.18);
}

/* 在線狀態 */
.status-dot {
  position: absolute;
  right: 0;
  bottom: 5px;
  z-index: 5;

  width: 20px;
  height: 20px;

  border-radius: 50%;
  background: #34d399;
  border: 4px solid var(--panel);

  box-shadow:
    0 0 0 2px rgba(52, 211, 153, 0.15),
    0 0 14px rgba(52, 211, 153, 0.75);
}

/* 水滴形狀持續波動 */
@keyframes avatar-liquid {
  0% {
    border-radius:
      48% 52% 56% 44% /
      52% 44% 56% 48%;

    transform: scale(1) translate(0, 0);
  }

  25% {
    border-radius:
      56% 44% 48% 52% /
      45% 58% 42% 55%;

    transform: scale(1.025, 0.985) translate(1px, -1px);
  }

  50% {
    border-radius:
      44% 56% 52% 48% /
      58% 46% 54% 42%;

    transform: scale(0.99, 1.025) translate(-1px, 1px);
  }

  75% {
    border-radius:
      53% 47% 43% 57% /
      48% 55% 45% 52%;

    transform: scale(1.018, 0.992) translate(1px, 1px);
  }

  100% {
    border-radius:
      48% 52% 56% 44% /
      52% 44% 56% 48%;

    transform: scale(1) translate(0, 0);
  }
}

/* 發光呼吸 */
@keyframes avatar-glow {
  from {
    filter: brightness(0.95) saturate(1);
    box-shadow:
      0 0 10px rgba(59, 130, 246, 0.45),
      0 0 22px rgba(139, 92, 246, 0.25);
  }

  to {
    filter: brightness(1.12) saturate(1.18);
    box-shadow:
      0 0 18px rgba(59, 130, 246, 0.72),
      0 0 38px rgba(139, 92, 246, 0.45);
  }
}

/* 水波向外擴散 */
@keyframes avatar-ripple {
  0% {
    transform: scale(0.95);
    opacity: 0;
  }

  20% {
    opacity: 0.45;
  }

  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

@media (max-width: 580px) {
  .avatar-wrap {
    --avatar-size: 96px;
    --ring-size: 6px;
  }
}

.profile-header { text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .2em; }
h1 { margin: 0; font-size: clamp(34px, 8vw, 50px); line-height: 1; letter-spacing: -.055em; }
.bio { margin: 16px auto 19px; max-width: 420px; color: var(--muted); line-height: 1.7; font-size: 15px; }
.copy-discord {
  margin: 0 auto; min-height: 42px; border: 1px solid var(--panel-border); border-radius: 999px;
  background: var(--card); color: var(--text); cursor: pointer; padding: 9px 13px;
  display: inline-flex; align-items: center; gap: 8px; transition: transform .2s ease, background .2s ease;
}
.copy-discord:hover { transform: translateY(-2px); background: var(--card-hover); }
.copy-discord svg { width: 19px; fill: #8b9cff; }
.copy-discord span:nth-child(2) { font-size: 13px; font-weight: 700; }
.copy-hint { color: var(--muted); font-size: 10px; padding-left: 7px; border-left: 1px solid var(--panel-border); }
.links { display: grid; gap: 13px; margin-top: 31px; }
.link-card {
  position: relative; height: 76px; min-height: 76px; padding: 12px 15px; border: 1px solid var(--panel-border); border-radius: 19px;
  color: var(--text); background: var(--card); text-decoration: none; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,.08); overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease;
}
.link-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.09), transparent 65%); transform: translateX(-110%); transition: transform .6s ease; }
.link-card:hover { transform: translateY(-4px) scale(1.012); background: var(--card-hover); border-color: rgba(139,92,246,.38); box-shadow: 0 17px 36px rgba(0,0,0,.16); }
.link-card:hover::before { transform: translateX(110%); }
.icon-box {
  flex: 0 0 49px;
  width: 49px;
  height: 49px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  line-height: 0;
}
.icon-box svg {
  display: block;
  width: 25px;
  height: 25px;
  flex: none;
  fill: currentColor;
  overflow: visible;
}
.instagram { background: linear-gradient(145deg, #f9ce34, #ee2a7b 48%, #6228d7); }
.instagram svg rect, .instagram svg circle { fill: none; stroke: currentColor; stroke-width: 1.8; }
.facebook { background: #1877f2; }
.facebook svg { width: 28px; height: 28px; transform: none; }
.github { background: #171717; }
.discord { background: #5865f2; }
.discord svg { width: 27px; height: 27px; }
.map { background: linear-gradient(145deg, #10b981, #0284c7); }
.link-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
  text-align: left;
  align-content: center;
}
.link-copy > * { margin: 0; }
.link-copy strong {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.link-copy small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 400;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 相容舊版卡片使用 h3 / p 的寫法，避免 Discord 卡片被預設 margin 撐高 */
.link-card .content,
.link-card .link-content { min-width: 0; display: grid; gap: 4px; align-content: center; }
.link-card .content h3,
.link-card .content p,
.link-card .link-content h3,
.link-card .link-content p { margin: 0; }
.link-card .content h3,
.link-card .link-content h3 { font-size: 15px; font-weight: 600; line-height: 1.25; }
.link-card .content p,
.link-card .link-content p { color: var(--muted); font-size: 13px; line-height: 1.25; }
.arrow { margin-left: auto; font-size: 19px; color: var(--muted); transition: transform .2s ease, color .2s ease; }
.link-card:hover .arrow { transform: translate(2px,-2px); color: var(--text); }
.live-badge { margin-left: auto; font-size: 9px; font-weight: 800; letter-spacing: .1em; color: #34d399; display: flex; align-items: center; gap: 5px; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; animation: pulse 1.6s infinite; }
.featured .arrow { margin-left: 0; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
footer { margin-top: 28px; color: var(--muted); font-size: 11px; display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 3; transform: translate(-50%, 30px); opacity: 0;
  padding: 12px 17px; border-radius: 14px; background: rgba(20,22,30,.92); color: white; box-shadow: 0 15px 50px rgba(0,0,0,.35);
  font-size: 13px; font-weight: 700; pointer-events: none; transition: .28s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 580px) {
  .page-shell { padding: 20px 12px; align-items: start; }
  .profile-card { padding: 36px 17px 23px; border-radius: 25px; }
  .avatar { width: 96px; height: 96px; font-size: 41px; }
  .link-card { height: 70px; min-height: 70px; padding: 10px 12px; }
  .icon-box { width: 45px; height: 45px; flex-basis: 45px; border-radius: 13px; }
  .live-badge { display: none; }
  .copy-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
