:root {
  --bg: #cbd5e1;
  --panel-bg: #ffffff;
  --subcard-bg: #f8fafc;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --active-bg: #ecfdf5;
  --active-text: #059669;
  --active-border: #a7f3d0;
  --dot-inactive: #94a3b8;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070a12;
    --panel-bg: #1e293b;
    --subcard-bg: #162032;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --muted: #94a3b8;
    --border: #334155;
    --border-strong: #475569;
    --accent: #60a5fa;
    --accent-soft: #1e3a8a;
    --active-bg: #064e3b;
    --active-text: #6ee7b7;
    --active-border: #065f46;
    --dot-inactive: #64748b;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  }
}

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

html {
  overflow-x: hidden;
}

body {
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  padding: 40px 16px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.has-custom-bg::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--custom-bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 740px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-header {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 18px;
}

.avatar {
  width: 82px;
  height: 82px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  background-color: var(--subcard-bg);
  flex-shrink: 0;
}

.profile-details {
  flex: 1;
  min-width: 0;
}

.name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

h1 {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: break-word;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background-color: var(--active-bg);
  color: var(--active-text);
  border: 1px solid var(--active-border);
}

.status-pill:empty {
  display: none;
}

.handle {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 3px;
  overflow-wrap: break-word;
}

.tagline {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
}

.tagline:empty {
  display: none;
}

.about {
  margin-top: 16px;
  font-size: 0.935rem;
  color: var(--text-secondary);
}

.about:empty {
  display: none;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.links:empty {
  display: none;
}

.links a {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  background-color: var(--subcard-bg);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: 6px;
  transition: border-color 0.15s, color 0.15s;
}

.links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.communities-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.community-card {
  background-color: var(--subcard-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.community-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.community-icon {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  background-color: var(--panel-bg);
  flex-shrink: 0;
}

.community-icon-fallback {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background-color: var(--panel-bg);
  color: var(--muted);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.community-info {
  flex: 1;
  min-width: 0;
}

.community-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.community-title a {
  color: var(--text);
  text-decoration: none;
}

.community-title a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.community-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}

.positions-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.position-row {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.position-track {
  width: 46px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.track-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: var(--dot-inactive);
  border: 2px solid var(--subcard-bg);
  box-shadow: 0 0 0 1.5px var(--dot-inactive);
  margin-top: 6px;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.position-row.is-current .track-dot {
  background-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.track-line {
  position: absolute;
  top: 17px;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background-color: var(--border-strong);
  z-index: 1;
}

.position-row:last-child .track-line {
  display: none;
}

.positions-list.is-single .position-track {
  display: none;
}

.positions-list.is-single .position-content {
  padding-left: 60px;
}

.position-content {
  flex: 1;
  min-width: 0;
  padding-bottom: 20px;
}

.position-row:last-child .position-content {
  padding-bottom: 0;
}

.position-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.role-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.role-name {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: break-word;
  word-break: break-word;
}

.current-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background-color: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--active-border);
}

.role-period {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 3px;
}

.role-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.footer {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  padding: 4px 0 12px;
}

@media (max-width: 600px) {
  body {
    padding: 16px 12px;
  }

  .container {
    gap: 14px;
  }

  .panel {
    padding: 16px;
    border-radius: 8px;
  }

  .panel-header {
    margin-bottom: 14px;
    padding-bottom: 10px;
  }

  .profile-header {
    gap: 14px;
  }

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

  h1 {
    font-size: 1.25rem;
  }

  .links a {
    flex: 1 1 auto;
    text-align: center;
    padding: 9px 12px;
  }

  .community-card {
    padding: 14px;
  }

  .community-top {
    gap: 12px;
  }

  .community-icon,
  .community-icon-fallback {
    width: 40px;
    height: 40px;
  }

  .positions-list {
    margin-top: 14px;
    padding-top: 14px;
  }

  .position-row {
    gap: 10px;
  }

  .position-track {
    width: 22px;
  }

  .positions-list.is-single .position-content {
    padding-left: 0;
  }

  .position-content {
    padding-bottom: 16px;
  }

  .role-name {
    font-size: 0.925rem;
  }

  .role-period {
    font-size: 0.78rem;
  }
}

@media (max-width: 380px) {
  .profile-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
