* {
  box-sizing: border-box;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: max(56px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --accent: #FF4D00;
}

body.bg-color {
  background:
    radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--bg-color, #0f0f0f);
  background-color: var(--bg-color, #0f0f0f);
}

body.bg-image {
  background-image:
    radial-gradient(circle at 50% -10%, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.55) 70%),
    var(--bg-image);
  background-size: cover;
  background-position: center;
}

body.theme-dark {
  color: #f5f5f7;
}

body.theme-light {
  color: #1d1d1f;
}

.pattern-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.pattern-wrap::before {
  content: '';
  position: absolute;
  inset: -35%;
  background-image: url('/images/nocmd-mark-tile.png');
  background-repeat: repeat;
  background-size: 34px 38px;
  transform: rotate(15deg);
}

body.theme-dark .pattern-wrap::before {
  opacity: 0.045;
}

body.theme-light .pattern-wrap::before {
  opacity: 0.09;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 70%, rgba(0, 0, 0, 0.22) 100%);
}

body.theme-light::after {
  background: radial-gradient(ellipse at center, transparent 72%, rgba(0, 0, 0, 0.08) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='2.4' intercept='-0.7'/%3E%3CfeFuncG type='linear' slope='2.4' intercept='-0.7'/%3E%3CfeFuncB type='linear' slope='2.4' intercept='-0.7'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.16;
}

.card {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 28px 32px;
  border-radius: 32px;
  backdrop-filter: blur(3px) saturate(200%);
  -webkit-backdrop-filter: blur(3px) saturate(200%);
}

.theme-dark .card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.03);
}

.theme-light .card {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 20px rgba(255, 255, 255, 0.2);
}

.avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent),
    0 8px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}

.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(160deg, var(--accent), color-mix(in srgb, var(--accent) 60%, black));
}

.name {
  margin: 20px 0 6px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.bio {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.45;
  max-width: 34ch;
  overflow-wrap: break-word;
}

.theme-dark .bio {
  color: rgba(245, 245, 247, 0.65);
}

.theme-light .bio {
  color: rgba(29, 29, 31, 0.65);
}

.links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 15px 20px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s ease,
    background 0.25s ease;
}

.theme-dark .link-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f5f5f7;
}

.theme-light .link-btn {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(29, 29, 31, 0.08);
  color: #1d1d1f;
}

.link-btn:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 20%, transparent);
}

.link-btn:active {
  transform: translateY(-1px) scale(0.97);
  transition-duration: 0.1s;
}

.link-btn.shape-pill {
  border-radius: 999px;
}

.link-btn.shape-rounded {
  border-radius: 14px;
}

.link-btn.shape-square {
  border-radius: 4px;
}

.icon-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex: none;
}

.theme-dark .icon-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.theme-light .icon-chip {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.icon {
  font-size: 15px;
}

/* ---- brand mark ---- */
.n-chip {
  position: relative;
  display: inline-block;
  flex: none;
  border-radius: 26%;
  background: var(--accent);
}

.n-chip::before {
  content: '';
  position: absolute;
  inset: 16%;
  background-image: url('/images/nocmd-mark-tile.png');
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  filter: brightness(0) invert(1);
}

/* ---- platform badge ---- */
.platform-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-top: 26px;
  padding: 8px 0;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.25s ease;
}

.platform-badge:hover {
  opacity: 0.85;
}

.platform-badge .n-chip {
  width: 18px;
  height: 18px;
}

.platform-badge span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.theme-dark .platform-badge { color: #f5f5f7; }
.theme-light .platform-badge { color: #1d1d1f; }

/* ---- cta button (404, empty states) ---- */
.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 30px;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a0a;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent);
}

.cta-btn:active {
  transform: translateY(0) scale(0.96);
}

/* ---- homepage ---- */
.home {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-hero {
  text-align: center;
  padding: 6px 10px 4px;
}

.home-hero .n-chip {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
}

.home-title {
  font-size: clamp(38px, 12vw, 48px);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 0 0 12px;
  text-wrap: balance;
}

.home-tagline {
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}

.theme-dark .home-tagline { color: rgba(245, 245, 247, 0.65); }
.theme-light .home-tagline { color: rgba(29, 29, 31, 0.65); }

.roster {
  width: 100%;
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.roster-label {
  padding: 0 6px 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.roster-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: 18px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(3px) saturate(200%);
  -webkit-backdrop-filter: blur(3px) saturate(200%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
}

.theme-dark .roster-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.13);
  color: #f5f5f7;
}

.theme-light .roster-card {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.6);
  color: #1d1d1f;
}

.roster-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--a, var(--accent)) 55%, transparent);
}

.roster-card:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

.roster-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  flex: none;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(160deg, var(--a, var(--accent)), color-mix(in srgb, var(--a, var(--accent)) 55%, black));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--a, var(--accent)) 30%, transparent);
}

.roster-who {
  flex: 1;
  min-width: 0;
}

.roster-who b {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-who span {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.theme-dark .roster-who span { color: rgba(245, 245, 247, 0.5); }
.theme-light .roster-who span { color: rgba(29, 29, 31, 0.5); }

.roster-go {
  font-size: 20px;
  font-weight: 300;
  opacity: 0.35;
  flex: none;
}

.roster-empty {
  text-align: center;
  padding: 36px 16px;
  font-size: 14px;
}

.theme-dark .roster-empty { color: rgba(245, 245, 247, 0.5); }
.theme-light .roster-empty { color: rgba(29, 29, 31, 0.5); }

/* ---- 404 ---- */
.notfound {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 420px;
  min-height: calc(100vh - 88px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}

.notfound-n {
  position: absolute;
  top: 4%;
  left: 50%;
  transform: translateX(-50%) rotate(15deg);
  width: 220px;
  height: 240px;
  opacity: 0.06;
  background-image: url('/images/nocmd-mark-tile.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.theme-light .notfound-n { filter: brightness(0); }

.notfound h1 {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin: 0 0 10px;
  text-wrap: balance;
}

.notfound p {
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 28px;
  max-width: 30ch;
}

.theme-dark .notfound p { color: rgba(245, 245, 247, 0.6); }
.theme-light .notfound p { color: rgba(29, 29, 31, 0.6); }

.reveal {
  opacity: 0;
  transform: translateY(14px);
  animation: reveal-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--i, 0) * 70ms + 60ms);
}

@keyframes reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    animation: none;
    opacity: 1;
    transform: none;
  }
  .link-btn {
    transition: none;
  }
}

@media (max-width: 600px) {
  body {
    padding: max(32px, env(safe-area-inset-top)) 12px max(24px, env(safe-area-inset-bottom));
  }

  .card {
    max-width: 100%;
    padding: 36px 20px 28px;
  }

  .avatar {
    width: 128px;
    height: 128px;
  }

  .avatar-fallback {
    font-size: 46px;
  }

  .name {
    font-size: 29px;
  }

  .bio {
    font-size: 16px;
    max-width: 100%;
  }

  .links {
    gap: 14px;
  }

  .link-btn {
    min-height: 54px;
    padding: 16px 20px;
    font-size: 16px;
  }

  .icon {
    font-size: 17px;
  }

  .home-hero .n-chip {
    width: 52px;
    height: 52px;
  }

  .home-title {
    font-size: 44px;
  }

  .home-tagline {
    font-size: 16px;
  }

  .roster-card {
    padding: 14px 15px;
    border-radius: 20px;
  }

  .roster-avatar {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }

  .roster-who b {
    font-size: 17px;
  }

  .notfound h1 {
    font-size: 34px;
  }

  .notfound-n {
    width: 260px;
    height: 280px;
  }
}
