:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --text-primary: #00ff88;
  --text-secondary: #888;
  --accent: #00ff88;
  --border: #333;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 40px 20px;
}

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

a:hover {
  text-decoration: underline;
}

/* Container */
.container {
  max-width: 600px;
  margin: 0 auto;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading-spinner {
  display: inline-block;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Error / Not Found */
.error-page {
  text-align: center;
  padding: 80px 20px;
}

.error-page h2 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

/* Profile Card */
.profile-card {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}

.profile-header-bg {
  height: 120px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  background-size: cover;
  background-position: center;
  position: relative;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid var(--bg-secondary);
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
}

.profile-card-body {
  padding: 50px 24px 24px;
  text-align: center;
}

.profile-username {
  font-size: 1.3rem;
  font-weight: bold;
  margin-bottom: 4px;
}

.profile-tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0;
}

/* Profile Sections */
.profile-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.profile-section h3 {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.profile-section p {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Identity fields */
.identity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.identity-row:last-child {
  border-bottom: none;
}

.identity-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.identity-value {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.identity-value code {
  font-family: inherit;
  color: var(--text-primary);
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.copy-btn.copied {
  border-color: var(--accent);
  color: var(--accent);
}

/* Social Links */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.2s;
}

.social-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.social-link .platform {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
}

/* Web Ring */
.web-ring-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.web-ring-link {
  font-size: 0.85rem;
  word-break: break-all;
}

/* Portfolio */
.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portfolio-item {
  display: block;
  padding: 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s;
}

.portfolio-item:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.portfolio-item .title {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.portfolio-item .desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Membership Badge */
.membership-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.membership-badge.free {
  background: rgba(136, 136, 136, 0.15);
  color: #888;
}

.membership-badge.colab_lite {
  background: rgba(0, 255, 136, 0.15);
  color: var(--accent);
}

.membership-badge.colab_pro {
  background: rgba(0, 255, 136, 0.2);
  color: var(--accent);
}

.membership-badge.factory {
  background: rgba(0, 255, 136, 0.25);
  color: var(--accent);
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.15);
}

.membership-badge.studio {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.membership-badge.benefactor {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

/* Footer */
.profile-footer {
  text-align: center;
  padding: 20px 0 40px;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.profile-footer .member-since {
  margin-bottom: 12px;
}

.profile-footer .actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.profile-footer .actions a {
  font-size: 0.85rem;
}

/* ═══════════════════════════════════
   Directory Page
   ═══════════════════════════════════ */

.directory-header {
  text-align: center;
  margin-bottom: 32px;
}

.directory-header h1 {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.directory-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.directory-item {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  text-decoration: none;
  transition: border-color 0.2s;
}

.directory-item:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.directory-item img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: 8px;
  background: var(--bg-primary);
}

.directory-item .name {
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.directory-item .tagline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-pagination {
  text-align: center;
  padding: 16px 0;
}

.directory-pagination button {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.directory-pagination button:hover {
  border-color: var(--accent);
}

.directory-pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Back link */
.back-link {
  display: block;
  text-align: center;
  margin-bottom: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.back-link:hover {
  color: var(--accent);
}

/* Responsive */
@media (max-width: 480px) {
  body {
    padding: 20px 12px;
  }

  .profile-card-body {
    padding: 50px 16px 20px;
  }

  .profile-section {
    padding: 16px;
  }

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

  .social-links {
    flex-direction: column;
  }

  .directory-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}
