:root {
  color-scheme: dark;
  --bg: #050609;
  --bg-soft: #090b10;
  --panel: rgba(22, 24, 31, 0.84);
  --panel-strong: rgba(26, 29, 38, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --line-bright: rgba(137, 214, 255, 0.32);
  --text: #f4f7fb;
  --muted: #aab3c0;
  --subtle: #737d8b;
  --accent: #27c3ff;
  --accent-2: #79f2c8;
  --accent-3: #ff8fb7;
  --status-color: #949ba4;
  --warning: #f4b860;
  --shadow: rgba(0, 0, 0, 0.48);
  --radius: 8px;
  --radius-lg: 14px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f6;
  --bg-soft: #f8fafc;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --line: rgba(15, 23, 42, 0.12);
  --line-bright: rgba(14, 165, 233, 0.28);
  --text: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --shadow: rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(120deg, rgba(39, 195, 255, 0.08), transparent 32%),
    linear-gradient(240deg, rgba(255, 143, 183, 0.07), transparent 34%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.018) 0 1px,
      transparent 1px 18px
    ),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
}

#ambient-canvas,
.texture-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

#ambient-canvas {
  z-index: -3;
}

.texture-layer {
  z-index: -2;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, transparent, black 14%, black 82%, transparent);
}

.theme-toggle {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  cursor: pointer;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 18px 40px var(--shadow);
  backdrop-filter: blur(18px);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.theme-toggle:hover {
  border-color: var(--line-bright);
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: scale(0.96);
}

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

[data-theme="dark"] .icon-sun,
[data-theme="light"] .icon-moon {
  display: block;
}

[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun {
  display: none;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr) minmax(210px, 270px);
  gap: 24px;
  width: min(1260px, calc(100% - 32px));
  margin: 0 auto;
  padding: 72px 0 36px;
  align-items: start;
}

.profile-column,
.main-column,
.friends-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 18px;
}

.avatar-stage,
.panel,
.intro-panel,
.project-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: 0 20px 55px var(--shadow);
  backdrop-filter: blur(20px);
}

.avatar-stage::after,
.panel::after,
.intro-panel::after,
.project-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.12), transparent 28%),
    linear-gradient(290deg, rgba(39, 195, 255, 0.08), transparent 36%);
  opacity: 0;
  transition: opacity 220ms ease;
}

.avatar-stage:hover::after,
.panel:hover::after,
.intro-panel:hover::after,
.project-card:hover::after {
  opacity: 1;
}

.avatar-stage {
  display: flex;
  align-items: center;
  padding: 20px 18px 24px;
  flex-direction: column;
  gap: 16px;
  transform-style: preserve-3d;
}

.avatar-frame {
  position: relative;
  width: min(260px, 76vw);
  margin-bottom: 30px;
  aspect-ratio: 1;
  border-radius: 34% 48% 44% 40%;
  isolation: isolate;
}

.avatar-frame::before {
  position: absolute;
  inset: -10px;
  z-index: -1;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: inherit;
  background:
    linear-gradient(135deg, rgba(39, 195, 255, 0.24), transparent 36%),
    linear-gradient(315deg, rgba(255, 143, 183, 0.2), transparent 42%),
    rgba(255, 255, 255, 0.02);
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.4));
}

.avatar-image,
.avatar-decoration {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  object-fit: cover;
}

.avatar-image {
  border: 1px solid var(--line);
  border-radius: inherit;
  background: #0c0f15;
}

.avatar-frame:has(.avatar-image.is-image-missing)::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  content: attr(data-fallback-text);
  color: #04131a;
  border: 1px solid var(--line);
  border-radius: inherit;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: clamp(2.4rem, 16vw, 4.5rem);
  font-weight: 850;
}

.avatar-decoration {
  z-index: 3;
  display: none;
  pointer-events: none;
  transform: scale(1.22);
}

.avatar-decoration.is-visible {
  display: block;
}

.status-dot {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  width: 52px;
  height: 52px;
  border: 6px solid var(--bg-soft);
  border-radius: 50%;
  background: #949ba4;
  box-shadow:
    0 0 0 1px var(--line),
    0 10px 24px rgba(0, 0, 0, 0.35);
}

.identity-line {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  gap: 12px;
}

.identity-line span {
  min-width: 0;
  overflow: hidden;
  font-size: 1.05rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-line small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  gap: 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.86rem;
}

.pulse {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--status-color);
  box-shadow: 0 0 0 color-mix(in srgb, var(--status-color) 40%, transparent);
  animation: pulse 1.7s infinite;
}

.panel {
  padding: 20px;
}

.panel-title,
.section-title {
  display: flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 14px;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 680;
}

.panel-title {
  justify-content: space-between;
}

.clan-badge {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 142px;
  padding: 5px 8px;
  gap: 5px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.2);
  font-size: 0.76rem;
}

.clan-badge img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.clan-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-grid {
  display: flex;
  min-height: 24px;
  flex-wrap: wrap;
  gap: 9px;
}

.badge-grid img,
.badge-fallback {
  width: 20px;
  height: 20px;
  border-radius: 5px;
}

.badge-grid img,
.badge-icon {
  object-fit: contain;
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.24));
}

.badge-fallback {
  display: grid;
  place-items: center;
  color: var(--subtle);
  border: 1px solid var(--line);
  font-size: 0.72rem;
}

.image-fallback {
  text-align: center;
  line-height: 1;
  text-transform: uppercase;
}

.about-panel {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.info-row,
.social-link {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.info-row strong,
.social-link span {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 1rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-icon,
.social-icon,
.platform-icons svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted);
}

.row-icon svg,
.social-icon svg,
.platform-icons svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.platform-icons {
  display: inline-flex;
  gap: 5px;
}

.social-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.social-link {
  width: fit-content;
  max-width: 100%;
  font-weight: 720;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.social-link:hover {
  color: var(--accent);
  transform: translateX(3px);
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 28px 30px;
  gap: 22px;
  align-items: end;
  transform-style: preserve-3d;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5.7rem);
  line-height: 0.92;
  letter-spacing: 0;
}

#hero-copy {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.24rem);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 116px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 760;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.button:hover {
  border-color: var(--line-bright);
  transform: translateY(-1px);
}

.button-primary {
  color: #021017;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.button-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.section-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skills-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.skill-item {
  display: grid;
  gap: 8px;
}

.skill-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.skill-head strong {
  color: var(--text);
  font-size: 1.03rem;
}

.skill-head span,
.project-card p,
.project-meta,
.contribution-list span,
.friend-name {
  color: var(--muted);
}

.skill-track {
  overflow: hidden;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.28);
}

.skill-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transition: width 900ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.project-list {
  display: grid;
  gap: 13px;
}

.project-card {
  display: grid;
  padding: 22px 24px;
  gap: 10px;
  transition:
    transform 160ms ease,
    border-color 160ms ease;
}

.project-card:hover {
  border-color: var(--line-bright);
  transform: translateY(-2px);
}

.project-card h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
  gap: 10px;
  color: var(--text);
  font-size: 1.14rem;
}

.project-card p {
  margin: 0;
  line-height: 1.55;
}

.project-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.86rem;
}

.project-meta svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.project-tags span {
  padding: 5px 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.76rem;
}

.contribution-panel {
  padding: 24px;
}

.contribution-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  gap: 18px;
  list-style: none;
}

.contribution-list a,
.friends-list a {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

.contribution-avatar,
.friend-avatar {
  display: grid;
  overflow: hidden;
  place-items: center;
  color: #061018;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
  object-fit: cover;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
}

.contribution-avatar {
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
}

.contribution-list span,
.friend-name {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friends-panel {
  max-height: calc(100vh - 154px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--subtle) transparent;
}

.friends-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  gap: 18px 14px;
  list-style: none;
}

.friend-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.friend-avatar.image-fallback,
.contribution-avatar.image-fallback {
  padding: 4px;
  font-size: 0.78rem;
}

.badge-fallback.image-fallback {
  font-size: 0.58rem;
  letter-spacing: 0;
}

.friends-list a {
  transition: transform 160ms ease;
}

.friends-list a:hover {
  transform: translateY(-2px);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px 42px;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--subtle);
  font-size: 0.9rem;
}

.site-footer span:first-child {
  color: var(--muted);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 20px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: shimmer 1.8s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(39, 195, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(39, 195, 255, 0);
  }
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 1040px) {
  .page-shell {
    grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  }

  .friends-column {
    grid-column: 1 / -1;
  }

  .friends-panel {
    max-height: none;
  }

  .friends-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .avatar-stage,
  .panel,
  .intro-panel,
  .project-card {
    box-shadow: 0 14px 34px var(--shadow);
    backdrop-filter: blur(12px);
  }

  .theme-toggle {
    top: 10px;
    left: 10px;
  }

  .page-shell {
    grid-template-columns: 1fr;
    width: min(100% - 24px, 560px);
    padding-top: 68px;
  }

  .avatar-stage {
    padding: 18px 16px 20px;
    gap: 14px;
  }

  .avatar-frame {
    width: min(232px, 68vw);
    margin-bottom: 18px;
  }

  .status-dot {
    right: 8px;
    bottom: 8px;
    width: 42px;
    height: 42px;
    border-width: 5px;
  }

  .intro-panel {
    grid-template-columns: 1fr;
    padding: 24px 22px;
  }

  .hero-actions {
    justify-content: flex-start;
  }

  .button {
    flex: 1 1 138px;
  }

  .contribution-list,
  .friends-list {
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    gap: 20px 12px;
  }

  .panel,
  .project-card {
    padding: 18px;
  }

  .friends-panel,
  .contribution-panel {
    padding-inline: 14px;
  }

  .friend-avatar {
    width: 60px;
    height: 60px;
  }

  .contribution-avatar {
    width: 52px;
    height: 52px;
  }

  .badge-grid {
    gap: 10px;
  }

  .badge-grid img,
  .badge-fallback {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 420px) {
  .contribution-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .identity-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
