:root {
  --bg: #000000;
  --surface: #121214;
  --surface2: #1c1c1e;
  --surface3: #2c2c2e;
  --frost-blue: #4fc8f8;
  --frost-deep: #1a7fc4;
  --accent-glow: rgba(79,200,248,0.28);
  --lite-a: #ff73fa;
  --lite-b: #b845ff;
  --green: #32d74b;
  --red: #ff6961;
  --text: #f5f5f7;
  --muted: #8e8e93;
  --muted-dim: #636366;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', 'Space Grotesk', sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(79,200,248,0.35);
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

.topo-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.09;
}

.topo-bg svg {
  width: 100%;
  height: 100%;
}

.tline {
  fill: none;
  stroke: var(--frost-blue);
  stroke-width: 1.2;
}

nav {
  position: sticky;
  top: 12px;
  z-index: 20;
  width: calc(100% - 32px);
  max-width: 1180px;
  margin: 12px auto 0;
  border: 1px solid var(--border);
  border-radius: 980px;
  background: rgba(20,20,22,0.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.nav-inner {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 14px 0 24px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-logo img {
  width: 20px;
  height: 20px;
}

.nav-logo-accent {
  color: var(--frost-blue);
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.nav-link {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--text);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 16px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 980px;
  padding: 14px 120px 14px 46px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search input::placeholder {
  color: var(--muted-dim);
}

.search input:focus {
  border-color: rgba(79,200,248,0.6);
  box-shadow: 0 0 0 4px rgba(79,200,248,0.12);
}

.search button {
  position: absolute;
  right: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: #06121c;
  background: var(--frost-blue);
  border: none;
  border-radius: 980px;
  padding: 9px 18px;
  cursor: pointer;
  transition: filter 0.2s;
}

.search button:hover {
  filter: brightness(1.08);
}

.search button:focus-visible,
.search input:focus-visible {
  outline: 2px solid var(--frost-blue);
  outline-offset: 2px;
}

.search--nav {
  width: 280px;
}

.search--nav input {
  font-size: 13.5px;
  padding: 9px 14px 9px 38px;
  background: rgba(255,255,255,0.05);
}

.search--nav .search-icon {
  left: 13px;
  width: 15px;
  height: 15px;
}

.search--nav button {
  display: none;
}

.search-error {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--red);
  text-align: center;
}

main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.home {
  min-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 0;
}

.home-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--frost-blue);
  margin: 0 0 14px;
}

.home h1 {
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.04;
  margin: 0 0 14px;
  text-wrap: balance;
}

.home-sub {
  max-width: 46ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 32px;
}

.home-search {
  width: 100%;
  max-width: 560px;
}

.home-hint {
  font-size: 12.5px;
  color: var(--muted-dim);
  margin: 4px 0 0;
}

.profile {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  padding: 40px 0 24px;
}

.viewer-card {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 38%, rgba(79,200,248,0.12), transparent 66%), var(--surface);
  overflow: hidden;
}

.viewer-card canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.viewer-card canvas:active {
  cursor: grabbing;
}

.viewer-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--muted-dim);
  pointer-events: none;
}

.viewer-mature {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border-strong);
  border-radius: 980px;
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.info {
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.name-row h1 {
  font-size: clamp(30px, 4.6vw, 44px);
  font-weight: 700;
  letter-spacing: -1px;
  margin: 0;
  overflow-wrap: anywhere;
}

.badge-lite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #1a0a1f;
  background: linear-gradient(100deg, var(--lite-a), var(--lite-b));
  border-radius: 980px;
  padding: 6px 12px;
  box-shadow: 0 6px 22px -8px rgba(255,115,250,0.6);
}

.badge-lite svg {
  width: 13px;
  height: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 980px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255,255,255,0.04);
}

.status-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.status-pill.is-online {
  color: var(--green);
  border-color: rgba(50,215,75,0.35);
  background: rgba(50,215,75,0.08);
}

.status-pill.is-online::before {
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(50,215,75,0.6);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(50,215,75,0.55); }
  100% { box-shadow: 0 0 0 8px rgba(50,215,75,0); }
}

.discord-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 22px;
}

.discord-row img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface2);
}

.discord-row strong {
  color: var(--text);
  font-weight: 600;
}

.discord-icon {
  width: 18px;
  height: 18px;
  color: #8c9eff;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 18px 18px 16px;
  min-width: 0;
}

.stat-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-value.is-muted {
  font-size: 16px;
  font-weight: 600;
  color: var(--muted-dim);
  padding-top: 6px;
}

.stat-sub {
  font-size: 12px;
  color: var(--muted-dim);
  margin-top: 4px;
}

.equipped {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px 18px;
}

.equipped-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
}

.equipped-name {
  font-size: 15px;
  font-weight: 600;
  margin-top: 2px;
}

.cape-thumb {
  width: 30px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 3px;
  background-color: var(--surface3);
  background-size: 640% 200%;
  background-position: 1.852% 6.25%;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

.section {
  padding: 28px 0 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.section-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 0;
}

.section-count {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.capes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.cape-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

a.cape-card:hover {
  border-color: rgba(79,200,248,0.4);
  transform: translateY(-2px);
}

a.cape-card:focus-visible {
  outline: 2px solid var(--frost-blue);
  outline-offset: 2px;
}

.cape-card .cape-thumb {
  width: 60px;
  height: 96px;
  border-radius: 4px;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.5));
}

.cape-card.is-mature .cape-thumb {
  filter: blur(9px);
}

.cape-card-name {
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cape-card-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  border-radius: 980px;
  padding: 3px 8px;
  color: #06121c;
  background: var(--frost-blue);
}

.cape-card-tag.is-mature {
  left: auto;
  right: 10px;
  color: var(--text);
  background: rgba(255,255,255,0.12);
}

.empty-note {
  font-size: 14px;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 22px;
  text-align: center;
}

.state {
  max-width: 460px;
  margin: 72px auto;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 40px 28px 34px;
}

.state-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--frost-blue);
  background: rgba(79,200,248,0.1);
}

.state-icon svg {
  width: 24px;
  height: 24px;
}

.state h1 {
  font-size: 24px;
  letter-spacing: -0.4px;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.state p {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 22px;
}

.state .search input {
  font-size: 14px;
}

.skeleton {
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.skel-name {
  width: 60%;
  height: 46px;
  margin-bottom: 18px;
}

.skel-stats {
  height: 96px;
  margin-bottom: 18px;
}

footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 22px 24px 28px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted-dim);
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--text);
}

@media (max-width: 860px) {
  .profile {
    grid-template-columns: minmax(0, 1fr);
  }
  .viewer-card {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
  }
  .search--nav {
    width: 200px;
  }
  .nav-link {
    display: none;
  }
}

@media (max-width: 560px) {
  main {
    padding: 0 16px;
  }
  .nav-inner {
    padding: 0 10px 0 16px;
  }
  .nav-logo-accent {
    display: none;
  }
  .search--nav {
    width: 100%;
    max-width: 210px;
  }
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .search input {
    padding-right: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-pill.is-online::before,
  .skeleton {
    animation: none;
  }
  a.cape-card,
  .search input {
    transition: none;
  }
}

.capes-grid .empty-note {
  grid-column: 1 / -1;
}
